View Single Post
Old 02-15-2011, 09:31 PM   #3
DMSmillie
Enquiring Mind
DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'
 
DMSmillie's Avatar
 
Posts: 562
Karma: 42350
Join Date: Aug 2010
Location: London, UK
Device: Kindle 3 (WiFi)
The "stack the blocks" concept works for the different sections of a "block" - margin, border, padding. However in CSS2, the default behaviour is for the vertical margins of "blocks" that adjoin each other (e.g. two paragraphs, one after the other) to "collapse" together, resulting in a shared margin which is equal in size to whichever individual margin is larger, rather than adding the two margins together.

So if the top paragraph has "margin-bottom:2em" and the bottom paragraph has "margin-top:1em", the result would be a 2em space between the paragraphs, not a 3em space.

(For a detailed description of this behaviour, in all its glory and with all the technicalese and minutiae and exceptions see http://www.w3.org/TR/CSS21/box.html#collapsing-margins).
DMSmillie is offline   Reply With Quote