[Cascading Style Sheets]
[Previous page] [Next page] [Section contents page]

Advantages of Style Sheets

It should first be said that just about anything you can do with style sheets can be done with conventional HTML tags (there are a few exceptions, and several things that can only be done with tedious HTML work-arounds). Nevertheless, there are some distinct advantages to using style sheets:

1. Logical separation of information structuring and formatting

HTML is sometimes described as a system for formatting documents; practically speaking, that is accurate, but it is not what HTML was intended to be. Instead, HTML was designed as an information structuring system that would designate the relative status of blocks of information (major heading, secondary heading, normal paragraph, etc.) and leave it to the local browser software to decide what formatting should be used to represent that structure. This design was in keeping with the idea that web documents would be completely independent of particular platforms and software. It also corresponds to the traditional relation between authors and publishers of printed texts, in which the author would supply content and information structure, and the publisher would decide what the text should actually look like. Word processors and desktop publishing systems have shifted much of the power to decide on appearance as well as content back into the hands of authors, however, and many authors are reluctant to relinquish that power again to the whims of web browsers.

Consequently, HTML has evolved into a complex and somewhat messy combination of structuring and formatting tags, which makes maintaining a large and complex web site very difficult (if you use the FONT tag, for instance, and want to change a font face or color across a number of pages, you can spend hours tracking down all the instances). Style sheets allow you to isolate formatting codes applied to many pages, so that general stylistic changes can be made by editing a single file.

2. Reducing bandwidth requirements and page loading time

When a user requests a web page, the browser has to parse all the HTML code on the page in order to display it. If you include a lot of complex formatting on your pages, that adds up to a lot of parsing for every page. By putting that formatting into a single style sheet referenced by each page, you reduce the amount of code on the individual pages, and thus reduce the amount of data that has to be transmitted and parsed. The result is pages that display more quickly and happier users.

[Previous page] [Next page] [Section contents page]