Book HomeCascading Style Sheets: The Definitive GuideSearch this book Sunday 25th of February 2018 10:26:20 PM
such as "2.1" or "7.1.3." This can, however,be done under CSS2 and is briefly discussed in Chapter 10, "CSS2: A Look Ahead".

7.7.3. List Item Positions

There is one other thing you can do toinfluence the appearance of list items under CSS1, and that'schange the position of the bullet itself, in relation to the contentof the list item. This is accomplished with

7.8. Summary

The ability to apply margins, borders, and padding to any element is one of the things that sets CSS so far above traditional Web markup. In the past, enclosing a heading in a colored, bordered box meant wrapping the heading in a table, which is a really bloated and awful way to create so simple an effect. It is this sort of power that makes CSS so compelling.

Unfortunately, this is also one of the areas where CSS support failed us in early implementations. Explorer 3 and Navigator 4 both had poor implementations of the box properties, although Navigator 4's bugs are almost legendary and are certainly close to being epic in nature. As the year 2000 dawned, however, the situation was rapidly improving, thanks to Explorer 4 and 5, and Opera 3.6 (and later).

List styles, on the other hand, were fairly well supported from the very beginning of CSS implementations. The ability to set images for bullets was missing from many early user agents, but support for the various kinds of counting schemes has long been evident.

Although this chapter attempted to provide a clear view of how the box properties work, there are many nuances and details to the CSS formatting model. Including all of them would have dramatically slowed down the progress of the chapter. Instead, these are all covered in the next chapter, which is largely theoretical in nature but which provides a comprehensive explanation of the workings of the CSS formatting model.

Library Navigation Links

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


We'll turn to the sidebar first. Each set of links is groupedinto a list under a main heading; these headings look different fromthe links. Each of the sections uses the following tags:

Whew! Already we have our work cut out for us.

Probably the easiest thing to do is to assign a class to thesidebar's table cell, so that we can specify certainappearances that are specific to the sidebar. This leads us to enter seem to be any way to override this behavior.

Despite its limitations, border is obviously avery useful property. It can even be used to work around what seemslike a completely unrelated bug in Netscape Navigator 4.x. If youassign a background color to an element and then view it inNavigator 4.x, the color will onlyappear behind the letters in the text and not cover the entirecontent area and padding. You can get around this by declaring:

the only real way in which margins affect line-breaking.

To understand why, let's go back to the paper-and-plasticanalogy employed in the previous section. Think of an inline elementas a strip of paper with marginal plastic surrounding it. Displayingthe inline element on multiple lines is like cutting up the stripinto smaller strips. However, no extra plastic is added to eachsmaller strip. The only plastic used is that which was on the stripto begin with, so it only appears at the beginning and end of theinline element. BODY attributes

There are many uses forcolor, of course, the most basic of which is toreplace the BODY attributesTEXT, LINK ,ALINK , and VLINK. Inconjunction with the anchor pseudo-classes, colorcan replace these BODY attributes outright. Thefirst line in the following example can be rewritten with thewill overlap other content. The direction and magnitude of the offsetare specified using some combination of the propertiestop, right,bottom, and left.


The element's box is completely removed from the flow of thedocument and positioned with respect to its containing block.