Style Sheets


As you've already learned, HTML was written as a markup language for defining the structure of a document (paragraphs, headings, tables, and so on). Although it was never intended to become a desktop publishing tool, it does include some basic formatting attributes, such as bgcolor, font-size, and align. In 1996, the W3C first recommended the idea of Cascading Style Sheets (CSS) to format HTML documents. The recommendation, which was updated in mid-1998, enables Web developers to separate the structure and format of their documents.

Style Sheet

A set of rules that determine how the styles are applied to the HTML tags in your documents.


The CSS recommendation describes the following three types of style sheets:

  • Embedded The style properties are included (within the <style> tags) at the top of the HTML document. A style assigned to a particular tag applies to all those tags in this type of document. In this book, you'll see embedded style sheets most often.

  • Inline The style properties are included throughout the HTML page. Each HTML tag receives its own style attributes as they occur in the page.

  • Linked The style properties are stored in a separate file. That file can be linked to any HTML document using a <link> tag placed within the <head> tags.

In the following sections, you'll learn how to construct these style sheets and how to apply them to your documents.

Tip

Even without all the formatting benefits that style sheets provide, Web developers can rejoice in knowing that using style sheets will no doubt be the biggest timesaver they've ever encountered. Because you can apply style sheets to as many HTML documents as you like, making changes takes a matter of minutes rather than days.

Before the advent of style sheets, if you wanted to change the appearance of a particular tag in your Web site, you would have to open each document, find the tag you wanted to change, make the change, save the document, and continue on to the next document. With style sheets, you can change the tag in a single style sheet document and have the changes take effect immediately in all the pages linked to it.




Sams Teach Yourself HTML in 10 Minutes
Sams Teach Yourself HTML in 10 Minutes (4th Edition)
ISBN: 067232878X
EAN: 2147483647
Year: 2004
Pages: 151
Authors: Deidre Hayes

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net