Book HomeCascading Style Sheets: The Definitive GuideSearch this book Saturday 31st of January 2015 08:10:22 PM

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:


By then, however, it was too late: there was an implementation in the marketplace, and rather than force Microsoft to change the browser and thus potentially cause existing pages to break, the standard was changed to reflect implementation. This means, sadly, that it is impossible to set a consistent clipping rectangle in situations where the height and width are not precisely defined. For example, there is no way to create a clipping rectangle that is 1 em larger than this element's content area:

Library Navigation Links

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

Figure 1-4

Figure 1-4. A browser offering alternate style sheet selection


Alternate styles sheets are only supported by one browser as of thiswriting -- Internet Explorer for Macintosh -- and that onlywith a JavaScript widget, which does not ship with the browser. Noneof the three major browsers natively supports the selection ofalternate style sheets (shown in Figure 1-4).

HTML up until now, of course. When you declare<BODY LINK="blue"VLINK="blue">, you probably expect that allhyperlinks will be the same shade of blue, no matter where they arein the document.

Well, don't change that thinking when you're using CSS.If you use CSS to set the color of all hyperlinks (both visited andunvisited) to be blue, then that's whatthey'll be. In the same way, if you use styles to set the


his property defines whether or not the background image scrolls along with the element. This is generally applied to BODY only, and in fact is largely supported only for that element. It is theoretically possible to create "aligned" backgrounds in multiple elements using this property; see Chapter 6, "Colors and Backgrounds", for more details.


faces with labels like Italic, Cursive,and Kursivare usually mapped to the italic keyword, whileoblique can be assigned faces with labels such asOblique, Slanted,and Incline. browser may vary.

In the case of ordered lists, CSS2 goes a great deal further than CSS1 to provide control over the ordering. For example, there is no way in CSS1 to automatically create subsection counters 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".