Chapter 8. Cascading Style Sheets

Style sheets are the way publishing professionals manage the overall “look” of their publications — backgrounds, fonts, colors, and so on — from a single page to huge collections of documents. Most desktop-publishing software supports style sheets, as do popular word processors, so the necessity of style sheets for HTML documents was obvious.

From the start, HTML focused on content over style. Authors are encouraged to worry about providing high-quality information and leave it to the browser to worry about presentation. We strongly urge you to adopt this philosophy in your documents — don’t mistake style for substance.

However, presentation is for the benefit of the reader, and even the original designers of HTML understood the interplay between style and readability — for example, through the physical style and header tags. Style sheets extend that presentation with several additional effects, including colors, a wider selection of fonts, and even sounds so that users can better distinguish elements of your document. But most importantly, style sheets let you control the presentation attributes for all the tags in a document — for a single document or a collection of many documents — from a single master.

In early 1996, the World Wide Web Consortium (W3C) put together a draft proposal defining Cascading Style Sheets (CSS) for HTML. This draft proposal quickly matured into a recommended standard. In mid-1998, the W3C extended the original specification ...

Get HTML & XHTML: The Definitive Guide, 5th 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.