I’m having a wrapper with a width of 960pixel, in that wrapper I have a div called firstTopSection, with a width of 940px, and a height of 300pixel, and a margin on 300pixel, and background of white.
Inside firstTopSection I have a div called canvasHolder, with a margin of 10 pixel, width of 920pixel, and a height of 280pixel… Color of yellow…
Collapsing margins are a pain at times as it seems more often than not you don’t want them to collapse. However once you understand how (and why) they work the way they do then you can cater for them quite easily.
If you want, say, 1em margin above and below your paragraphs, I like the way the top and bottom margins of each paragraph merge with those of the next. It would be a hassle if the space between paras doubled. So there are advantages.
Yeah, I can see something handy in the collapsing, but there should be a like “margin-collapse: none” property or something,
But yes indeed, I understand why it’s like that I think…
You have a div that is 200x200 pixel, and a div inside that is 180x180 pixel, with a 10pixel margin… Margin is giving space outside the box to the next “element” the next element is “taken” up by the margin, so it take it’s parents “outline of the margin”, because it’s the closest “item” where you really have something that isn’t a margin lol…