At 2:40 PM -0500 10/5/06, Jason Hammons wrote:
>is that gap in the first example margin? if so, is there anyway to
>get rid of the gap other than specifying margin-top: 0; for the paragraph?
>any clarification would be appeciated. thanks! j
I'll get the self-written content plug out of the way first:
http://complexspiral.com/publications/uncollapsing-margins/
Okay. If I've understood your questions correctly, the answers
are: yes, that gap you see at first is margin (the paragraph's top
margin); and no, you can't get rid of the gap without removing the
top margin on the paragraph.
As you discovered, you can get the bottom div to "stretch up" by
adding a border (or padding, which would accomplish the same thing),
but that just trades an open gap between the divs for a gap that's
filled by the top portion of the bottom div.
A common way to defeat this sort of thing, though it may not work
in every case, is to set paragraph margins as follows:
p {margin: 0 0 1em;}
That way, if you have multiple paragraphs together, they'll maintain
their usual 1em separation thanks to the bottom margins, but they
won't have top margins to cause unexpected effects like the one you
saw. Like I say, that won't always work-- sometimes, you want
paragraphs to have top margins for one reason or another-- but in my
experience it seems to be a useful approach about 90% of the time.
--
Eric A. Meyer (http://meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
-- Martina Kosloff (http://mako4css.com/)
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/