Wrapping It Up
Although the margin collapse behavior is at first a little unintuitive, it does make
life easier in the case of multiple nested elements, where the behavior is often
desirable. As shown above, easy methods are available to help you stop the collapse
if required.
CSS Layout and Formatting
The Ultimate CSS Reference 156
The Internet Explorer 5 Box Model
Relevance of the Internet Explorer 5 Box Model
This topic is included mainly for a historical reference, as Internet Explorer 5.5 and
earlier versions have less than 1% market share today. However, Internet Explorer
6 and 7, and Internet Explorer 5 for Mac, all use this box model when they??™re
operating in quirks mode (p. 17), so the topic still has some relevance today.
In the CSS box model (p. 142), as defined by the CSS2.1 specifications, an element
ascertains its total dimensions by adding together the content area dimensions plus
any margin, padding, or borders that may have been declared. Conversely, if we
use the Internet Explorer 5 box model (the IE5 box model for short),9 padding and
borders will shrink the content area??™s dimensions instead of increasing the element??™s
total dimensions.
Pages:
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237