Chapter 9. Cascading Style Sheets

Style sheets are the way publishing professionals manage the overall “look” of their publications—backgrounds, fonts, colors, etc. Most desktop publishing software supports style sheets, as do the popular word processors.

From its earliest origins, HTML focused on content over style. Authors were encouraged to provide high quality information, and leave it to the browser to worry about presentation. We strongly urge you to adopt that philosophy in your HTML documents. However, while use of the HTML <font> tag and related attributes like Wcolor produce acute presentation effects, style sheets, when judiciously applied, bring consistency and order to documents. Style sheets let the HTML author control the presentation attributes for all the tags in a document or a whole collection of many documents, and from a single master style sheet.

In early 1996, the World Wide Web Consortium put together a draft proposal defining Cascading Style Sheets (CSS) for HTML. This draft proposal quickly matured into a recommended standard, which the commercial browser manufacturers were quick to exploit. Style is fast achieving parity with content on the World Wide Web.

Since we realize that eventual compliance with the W3C standard is likely, we’ll cover all the components of the standard in this section, even if they are not yet supported by any browser. We’ll denote clearly what is real, what is proposed, and what is actually supported.

The Elements of Styles

At ...

Get Webmaster in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.