Cascading Style Sheets

« BACK TO DICTIONARY INDEX

Welcome to our site


It is more efficient to embed all style definitions at the head of a document, defining what color each level of headings should be. This is called an embedded style sheet. A style class can be invented and applied to any tag. Class names begin with a period, and their function is enclosed in braces. Here is a simple example of an embedded style sheet:

In this example, first-level headings (H1) appear in blue letters, and headings of the new class called H1.yellow appear in yellow letters.
A style sheet can be linked to a page yet stored in a file by itself. When a text file contains all the information that would be included in an embedded style sheet and when the tag is used, the file (named style.css, for example) will behave as though it were embedded. The page can reference this style sheet if the following line is placed at the head of the document:

The cascading function arises from a hierarchy in which the browser follows directions. Browser defaults are the most general style rules, which are overruled by definitions in a style sheet. Inline rules stated at the tag level take precedence, followed by an embedded style sheet, followed by a linked style sheet. A class definition overrules the default presentation for a tag, and inline style definitions overrule everything else. The level of control is really what cascades.