Loading ...
Sorry, an error occurred while loading the content.

6137RE: [NH] Re: margins for paragraphs

Expand Messages
  • Corl DeLuna
    Sep 30, 2007
    • 0 Attachment
      Hi Axel,

      I've been using the Global White Space Reset technique for a long time now
      http://leftjustified.net/journal/2004/10/19/global-ws-reset/ taking almost
      all of the guess work out of why my explicit margins aren't behaving. It's
      very easy to implement.

      * { /*global reset*/
      padding: 0;
      margin: 0;

      I don't set any margins for my paragraphs, instead I let them inherit the
      parent div margins. This prevents the confusion of the margins of one
      element adding to another.

      For my own sanity, I explicitly state all four directions in each margin,
      even when 0:

      line-height: 1.4em;
      margin: 0 0 .7em 0;

      I'm looking at adopting the YUI Reset CSS technique
      <blocked::http://developer.yahoo.com/yui/reset/> to create a level playing
      field across most browsers.

      Hope this helps some.


      From: ntb-html@yahoogroups.com [mailto:ntb-html@yahoogroups.com] On Behalf
      Of Axel Berger
      Sent: Sunday, September 30, 2007 12:41 AM
      To: ntb-html@yahoogroups.com
      Subject: Re: [NH] Re: margins for paragraphs

      Cary wrote:
      > I'll admit I'm having trouble following this, but you might use
      > padding on the div to create space between it and the paragraph it
      > contains rather than using a margin on the paragraph.

      I forgot I wrote the following only to Don:

      I am currently using padding in the container and setting margins to
      zero for all <P> inside that container - but what if there's more than
      one paragraph? All in all this is very unsatisfactory. This problem is
      also solved by placing a border around the container and having the
      paragraph margin push against that, but again this is not always

      > So for you example code you gave you could use this styling:

      You are absolutely right! What must have happenened (again!) when I
      tried that first was some silly typo and I had to take away the
      paragraph margins altogether.
      I have now found two more things:
      1) Doing it exactly your way the outer margins inside the light DIVs get
      somewhat bigger than I'd like them.
      2) Even I very small nominal padding of just one pixel does the trick
      and everything looks perfect.

      Oh for the syntax error messages in compilers that don't let typos slip
      by so easily!


      [Non-text portions of this message have been removed]
    • Show all 4 messages in this topic