Prev | Current Page 302 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

142), collapsing margins (p. 148),
containing blocks (p. 147), and floating and clearing (p. 180) to understand exactly
how margins work for all elements. The section on inline formatting (p. 166) also
explains how margins affect inline elements.
Value
The property takes a CSS length (px, pt, em, and so on), the keyword auto, or a
percentage of the width of the element??™s containing block (p. 147). Note that even
for the top and bottom margins the percentage value will refer to the width of the
containing block. If the containing block??™s width depends on the element to which
percentage margins are applied, the resulting layout is undefined in CSS2.1.
Negative values are allowed for margins (although implementation-specific limits
may apply), and have the effect of pulling the element in the direction of the margin
specified. This may cause the element to overlap other elements, which may, of
course, be the desired effect. In cases where overlap occurs, we can determine the
elements??™ stacking levels by applying z-index values to them.


Pages:
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314