Sent by Big John on 31 January 2003 03:03
David Kurtz wrote:
> <http://home.earthlink.net/~d0/blocktest/test_space.html>
>
> It seems that when I have this configuration alone (indents
> indicate hierarchy):
>
> body
> table
> div
> h2
> p
>
> The div gets pushed away from the table by some amount.
>
> If I do the following:
>
> body
> table
> div style="border-top: 1px solid black;"
> h2
> p
>
> The div's boundaries nestle up against the bottom of the table.
> Relatively speaking, the h2 doesn't seem to move. It looks as
> though the amount of space between the top of the h2 and the
> bottom of the table is the same in either case.
What's happening is that the top margins of the <hx> and the div
are collapsing together, because they are nested, and no borders
or padding intervene between them. This collapsed margin appears
above the div, but since the div has no default margins, the
default <hx> top margin (being larger), becomes the top margin
on the div.
This actually is according to the specs,
and I also had a tuff time with it:
http://www.w3.org/TR/REC-CSS2/box.html#collapsing-margins
So kill the top margin on the <hx>, and shazzam! No gap.
HTH
Big John
=====
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-
| Perennial student + Impractical joker + CSS junkie = Big John |
| XXXX <http://users.rraz.net/mc_on_the_rocks/testpage/pie.html> XXXX |
| XXXXXXXXXXXXX <http://users.rraz.net/mc_on_the_rocks/> XXXXXXXXXXXX |
-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com