![[Graphic: Tools You Can Use]](/computing/windows/graphics/ToolsM.gif)
Many people write documents for the Web using HTML, but are frustrated by its limited ability to control how their Web pages look. If you are in this group, consider using style sheets.
Using style sheets makes your HTML source document a bit shorter, as you can move any code for the presentation out of your HTML document and into your style sheet. Because the style sheet can be cached by a user's browser, performance is also a little better.
|
What Does a Style Sheet Look Like?
A style sheet can be only a few lines, or it can be dozens of lines long. Here is a very simple style sheet:
BODY {color: black; background: white}
This style sheet defines the text color as black, the background color as white, the headers (H1-H6) as first Palatino, then Helvetica, then as any other sans-serif font in your computer system. Your browser will pick the first defined font that works for your system. Finally, the size of the ADDRESS font is defined to be 75 percent of the default text size.
|
If you use a style sheet to define fonts and colors, then the reader can choose whether to view the document with your style sheet or to make adjustments. If you define fonts and colors in the HTML code, you take the option of reader-adjusted viewing--and perhaps accessibility--away. You can read more on this topic at www.mcsr.olemiss.edu/~mudws/font.html
The problem is that no browser implements the entire specification, and some older browsers do not support CSS1 at all. The trick is to figure out what features you can use that will degrade gracefully on browsers that do not support them. The Web Review (at webreview.com/wr/pub/guides/style/style.html) publishes a style sheets reference guide with handy charts on what features of CSS1 are supported by which browsers.
Netscape Navigator 4, Internet Explorer 4, and Opera 3 all support parts of CSS1. Opera 3 supports the most features at the moment, with Internet Explorer 4 coming in second.
Be aware that their core style sheets will detect what browser you have, and then modify the style sheet according to that information. As browser support for cascading style sheets improves, this browser sniffing will not be necessary.