Box model

Giganews Newsgroups
Subject: Box model
Posted by:  Mateusz Grotek (unoduet…@poczta.onet.pl)
Date: Sun, 25 Jan 2009

I have huge problem with understandding these sentences from CSS 2.1
specification. I tried irc, but nobody could help me. Could you please
explain the meaning of it:

<CITE>
If the top and bottom margins of a box are adjoining, then it is
possible for margins to collapse through it. In this case, the position
of the element depends on its relationship with the other elements whose
margins are being collapsed.

    * If the element's margins are collapsed with its parent's top
margin, the top border edge of the box is defined to be the same as the
parent's.
    * Otherwise, either the element's parent is not taking part in the
margin collapsing, or only the parent's bottom margin is involved. The
position of the element's top border edge is the same as it would have
been if the element had a non-zero top border.
</CITE>

I'll try to show why i don't understand it.

<CITE>
If the top and bottom margins of a box are adjoining, then it is
possible for margins to collapse through it.
</CITE>
When top and bottom margins of a box are adjoining?? When it is empty,
without borders etc. I assume from now that we are speaking about empty
boxes, with no borders, so margins can adjoin.

<CITE>
In this case, the position of the element depends on its relationship
with the other elements whose margins are being collapsed.
</CITE>
I assume "element" refer to this empty box.

<CITE>
  * If the element's margins are collapsed with its parent's top margin,
the top border edge of the box is defined to be the same as the parent's.

What???
top border edge????
it's empty box, i doesn;t have any borders... still it has an edge, ok.
So it means that this empty element's empty content is where top border
edge of parent is.

<CITE>
* Otherwise, either the element's parent is not taking part in the
margin collapsing, or only the parent's bottom margin is involved. The
position of the element's top border edge is the same as it would have
been if the element had a non-zero top border.
</CITE>
It means that if no top margin of parent is involved, it bahaves normally.

The problem is that this behaviour is normal with collapsing borders.
Why is this some special case? I don't understand it. Is it because it
should work even for non block entities. Or what? Could anybody explain
it to me (best with some example).
Thank you in advance.

Replies