Anne van Kesteren

CSS: handling of margin

I think this is one of the most complicated CSS issues, but it is also quite important, since you will come across this with quite a lot of designs. I think I don't really understand the specification myself this time. Internet Explorer's behavior makes more sense to me, but that was the same when I first heard about the W3C box-model, which is actually quite good if you take a look at it from different situations (IMG and the IE box-model aren't making any sense for example). Back to the margin property, I made a small page with some quotes and explanation of the problem: CSS, handling of margin-top. I will update the page with a better explanation as soon as I understand the problem better.

Comments

  1. Have you read Andy Budd::Blogography: No Margin for Error?

    Hehe.. I think you did. Why the hell am I posting this???

    Posted by Mark Wubben at

  2. Ah, the mysteries of margin-collapse: the most ill-conceived idea to feature in XHTML (and it's predecessors). I can't see any way in which margin-collapse is a good idea, and it definitely gets in the way of CSS changes

    Posted by Gary Fleming at