Eric Meyer has published another great resource for the Web development community: Uncollapsing Margins discusses “how margin collapsing can lead to weird behaviors, why these behaviors arise, and ways to work around it when you want a different result. If you’ve ever tried to figure out why a heading’s top margin seems to disappear when it’s the first thing in a div, this article will be of interest.”
Margin collapsing is one of the most confusing aspects of CSS as it isn’t mentioned very often, and until this article, I hadn’t seen a comprehensive explanation of why it happens, and how to “un-collapse” them. Yes, some people posted work in various forums and lists, but Eric has taken the time to tie everything together.
For anyone unfamiliar with Eric, he is the author of many great CSS books, including:
- Eric Meyer on CSS (I highly recommend this book for new and experienced developers)
- More Eric Meyer on CSS
- Cascading Style Sheets: The Definitive Guide
- Cascading Style Sheets 2.0 Programmer’s Reference
- CSS Pocket Reference