Click to buy
Cascading Style Sheets: The Definitive Guide
By Eric A.
Meyer
Introduction
What a Mess
Rich Styling
Ease of Use
Using Your Styles on Multiple Pages
Cascading
Preparing for the Future
Implementations
Bringing CSS and HTML Together
Summary
Printer Friendly Version
Chapter 1
HTML and CSS
In many ways, the Cascading Style Sheets (CSS) specification
represents a unique development in the history of the World Wide Web. In its
inherent ability to allow richly styled structural documents, CSS is both a
step forward and a step backward--but it's a good step backward, and a needed
one. To see what is meant by this, it is first necessary to understand how the
Web got to the point of desperately needing something like CSS, and how CSS
makes the web a better place for both page authors and web surfers.
The Web's Fall from Grace
Back in the dimly remembered early years of the Web (1990
-1993), HTML was a fairly lean little language. It was almost entirely
composed of structural elements that were useful for describing things like
paragraphs, hyperlinks, lists, and headings. It had nothing even remotely
approaching tables, frames, or the complex markup we assume is a necessary
part of creating web pages. The general idea was that HTML would be a
structural markup language, used to describe the various parts of a document.
There was very little said about how these parts should be displayed. The
language wasn't concerned with appearance. It was just a clean little markup
scheme.
Then came Mosaic.
Suddenly, the power of the World Wide Web was obvious to almost
anyone who spent more than ten minutes playing with it. Jumping from one
document to another was no harder than pointing the mouse cursor at a
specially colored bit of text, or even an image, and clicking the mouse
button. Even better, text and images could be displayed together, and all you
needed to create a page was a plain text editor. It was free, it was open, and
it was cool.
Web sites began to spring up everywhere. There were personal
journals, university sites, corporate sites, and more. As number of sites
increased, so did the demand for new HTML tags that would allow one effect or
another. Authors started demanding that they be able to make text boldfaced,
or italicized.
At the time, HTML wasn't equipped to handle these sorts of
desires. You could declare a bit of text to be emphasized, but that wasn't
necessarily the same as being italicized--it could be boldfaced instead, or
even normal text with a different color, depending on the user's browser and
their preferences. There was nothing to ensure that what the author created
was what the reader would see.
As a result of these pressures, markup elements like <B> and <I> started to
creep into the language. Suddenly, a structural language started to become
presentational.
Introduction
What a Mess
Rich Styling
Ease of Use
Using Your Styles on Multiple Pages
Cascading
Preparing for the Future
Implementations
Bringing CSS and HTML Together
Summary