immediately follows another such element in the document'slayout.

A perfect example is an unordered list, in which the list itemsfollow one another. Assume that the following is declared for a listthat contains five list items:

LI {margin-top: 10px; margin-bottom: 15px;}

Thus, each list item has a 10-pixel top margin and a 15-pixel bottommargin. However, when the list is rendered, the distance between Book HomeCascading Style Sheets: The Definitive GuideSearch this book Saturday 28th of November 2015 05:01:27 AM

10.6. Borders

In CSS1, there are quite a few properties devoted to setting borders around element boxes, such as border-top-width and border-color, not to mention border itself. CSS2 adds a even more border properties, most of which are aimed at giving the author even more specific control of the borders. Before, it was difficult to set a specific color or style for a given side of the border, except through properties like border-left, and that could require more than one value. The new CSS2 properties address this, and their names are pretty self-explanatory:


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.

item's content and the top of the paragraph's content.This is what we see in Figure 8-24.

Figure 8-24. Collapsing margins and negative margins, in detail

There is one area of unresolved behavior, which is this: if elementsoverlap each other due to negative margins, which elements are"on top?" You'll note that few of the examples inthis section use background colors for all elements. That'sbecause if they did, content might get overwritten by the backgroundcolor of a following element. The CSS specification does not say what