Book HomeCascading Style Sheets: The Definitive GuideSearch this book Wednesday 13th of December 2017 08:03:55 PM

5.7. Summary

Although authors cannot count on a specific font being used in a document, they can very easily specify generic font families to be used. This particular behavior is generally very well supported, since any user agent that didn't let authors (or even readers) assign fonts would quickly find itself out of favor.

As for the other areas of font manipulation, support varies. Changing the size of fonts usually works well, but twentieth-century implementations ranged from frustratingly simplistic to very nearly correct in this area. The frustrating part for authors, though, is usually not how font sizing is supported, but how a unit they want to use (points) can yield very different results in different media, or even different operating systems and user agents. The dangers of using points are many, and using length units for web design is generally not a good idea. Percentages, em units, and ex units are A:link {color: #808080;} A:active {color: silver;} A:visited {color: #333333;}

Figure 6-3

Figure 6-3. Replacing BODY attributes with CSS

While this may seem like a lot of extra typing, consider that using the old method of BODY attributes, you could only make changes at the document level. For example, if you wanted some links to be medium gray and others a relatively dark gray, you couldn't do that with the BODY attributes. Instead, you'd have to use <FONT usually best for changing font sizes, since these scale very well in all common display environments.

Now that we've worked our way through altering text and fonts, let's turn to ways to style the elements that contain the text.



Library Navigation Links

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

WARNING

There's a downside: as of this writing, web browsersdon't get this fixed alignment right, so this example was justan interesting theoretical exercise.

6.2.6. Bringing It All Together

remain are the details of what happens when absolute positioning isinvoked.

When an element is positioned absolutely, it is completely removedfrom the document flow. It is then positioned with respect to itscontaining block, and its edges are placed using the side-offsetproperties. The positioned element does not flow around the contentof other elements, nor does their content flow around the positionedelement. This implies that an absolutely positioned element mayoverlap other elements, or be overlapped by them. (We'll see

font-variant

As for font-variant, it has but two values: the default of normal, which describes ordinary text, and small-caps, which calls for the use of small caps text. If you aren't familiar with such an effect, It

Once again, we present some color equivalents in Table 3-3.

Table 3-3. Hexadecimal Equivalents for Common Colors