Part II: The Pendulum
David Siegel takes a look at the state of Cascading Style Sheets and how they should be used. Avoid style sheet terrorism, come to realization of who is in control of the way your pages look and keep the code pure. Read on...
Do you want to know more?
- Related H5 material
- Selected outside reading
- Buy, browse related books
Who gets the final say over the look of a document?
Let's take one thing at a time. If we're going to learn anything, it's that style sheets are the future and tag-based layout is the past. What can style sheets do? They can do a lot of typographic things, like set your margins, indents, drop caps, leading, and other niceties invented in the time of the Romans. No longer should we pour our text into tables, for I have led us through the desert for forty years (seemed like it, anyway), and we have emerged in the promised land, where style sheets give us the margins we seek. Sure, we still have to use tables to lay out our pages, but in a year or so, we hope to give that up, too. Say goodbye to the Single-Pixel GIF! Use it only when necessary! Ban the kluges—learn to use style sheets today.
Okay, maybe tomorrow. Turns out that the Internet Explorer 3.0 version of style sheets is pretty different from the 4.0 version, and the Netscape Communicator version will likely have its differences. We will find the common presentational behavior of both 4.0 browsers and use that. Stay tuned. One thing you don't want to do is to commit style-sheet terrorism. Style-sheet terrorism is where you use style-sheet capabilities by brute force, mixing the style primitives right into your content, rather than separating the content from the description of the presentation.
Look at Microsoft's Style Gallery. It's shameful. Look at both the code and with Netscape Navigator 3.0. What's going on? To get a drop-shadowed "3," they've used the actual number two times—once dark and once light—positioned on top of each other. Not only that, but the number itself is part of an ordered list—the program should take care of the numbering automatically! The style sheet should describe the behavior of an ordered list in the absence of the list data. I repeat: there should be no use of style sheets to effect typography that is bound to the content. Style sheets must describe content that isn't there, then be applied to content that is. If the style sheet doesn't give the intended result, debug the style sheet, not the data.
To be fair, the gallery was created last summer in a rush. The people hired to make it were just playing around. But they didn't understand the basic concept, and Microsoft let everyone see it as an example of how to use style sheets, mostly because it looks awful in Netscape. If you did it correctly, your pages would just look gray and dull in Netscape, rather than all screwed up, and that would reflect badly on Microsoft, hence the style-sheet terrorism.
The big-brother issue
One of the central questions surrounding the use of style sheets is: Who gets the final say over the look of a document? Some small percentage of people is colorblind, another group prefers larger type, and others have special viewing requirements. Then there are alternative surfing environments like web phones, web TV, and web dishwashers. Each has its own special browser and its own limitations. Aside from that, issues of available typefaces, available colors, monitor size, and other parameters affect the average surfer every day. Should there only be one way to view a web page?
Related H5 Material
Selected Outside Reading
- Beyond the FONT tag: Practical HTML text styling @ Agitprop
- Why don't you code for Netscape? @ A List Apart
- Practical CSS Layouts Tips, Tricks & Techniqies @ A List Apart
Buy, browse related books
- Designing CSS Web Pages by Christopher Schmitt
- Eric Meyer on CSS by Eric Meyer
- Creating Killer Web Sites by David Siegel