Book HomeCascading Style Sheets: The Definitive GuideSearch this book Friday 20th of April 2018 04:40:38 PM

4.2. Summary

Even without trying to alter the font in use, there are many ways to change the appearance of text. There are classic effects such as underlining, of course, but CSS also gives us the ability to draw lines over text or through it, change the amount of space between words and letters, indent the first line of a paragraph (or other block-level element), align text to the left or right, and much more. You can even alter the amount of space between lines of text, although this operation is unexpectedly complicated and covered in detail in Chapter 8, "Visual Formatting".

These behaviors are all relatively well supported, or else not supported at all. Full justification of text is one of the big ones that is not well supported, and most user agents released during the twentieth century exhibited bugs in the text decoration and vertical alignment, as well as line height calculations. On the other hand, word and letterspacing almost always work correctly when they're supported, and text indentation has experienced only a few very small bugs. The same is true of the ability to alter capitalization, which is usually supported correctly.

Of course, the other thing authors generally want to do with text is change which font is being used, as well as change its size, weight, and other aspects of the font. We'll see how this happens in the next chapter.

BODY element, e.g., a paragraph or headingelement. With the right styles, the containing block for thepositioned element will be the entire BODYelement. Thus, applying the following styles to theBODY and the fifth paragraph in a document wouldlead to a situation similar to that shown in Figure 9-20:

BODY {position: relative;}<P STYLE="position: absolute; top: 0; right: 25%; left: 25%; bottom: auto;width: 50%; height: auto; background: silver;">...</P>

Library Navigation Links

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

one (labeled "Default" in this case) to whichever the reader picked. Figure 1-4 shows one way in which this selection mechanism might be accomplished.

Figure 1-4

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


Alternate styles sheets are only supported by one browser as of this writing -- Internet Explorer for Macintosh -- and that only with a JavaScript widget, which does not ship with the browser. None of the three major browsers natively supports the selection of to the other aspects of borders, setting the color is pretty easy. InCSS1, there is the single property border-color,which can accept up to four color values at one time.

If there are less than four values,value replicationtakes effect. So if you want H1 elements to havethin, black top and bottom borders with thick, gray side borders, andmedium, gray borders around P elements, this willresults from all browsers. Since no one can clearly say which isright, none of them can really be considered to be buggy -- atleast, not until the specification issufficiently clarified.

8.2.3. List Items

Speaking of list items, they have a fewspecial rules in addition to everything discussed so far. List itemsare typically preceded by a