Welcome
Introduction
Frames
Page layout
with tables
Style Sheets
JavaScript
Dynamic HTML
Related links

Handout (PDF)
ACCC Seminars
ITL home page
last revision:
2000-03-02

Cascading Style Sheets


 

 

A style sheet specifies how certain page-elements should be displayed, e.g. preferred typefaces, colors, backgrounds. If no styles are specified, the user's preferences are used, then the browser's default values (cascading). Style sheets can be overridden by the user, allowing for individual needs and preferences.

According to the specification, styles also follow the principle of inheritance, i.e. elements inherit their properties from other elements containing them. Example: a link in a paragraph will use the same typeface as the whole paragraph, unless the typeface for links has explicitly been set differently. But...

Linked styles vs. embedded styles:

Styles can be placed into an external stylesheet, a file with .css extension, which makes them re-usable for other pages. This simplifies maintaining a unified style for a whole site. Link to them in the HEAD (external styles).

When styles are unique to a document, but recurring multiple times, they should be placed directly in the document's HEAD area (global styles). Styles can also be applied to individual selections, mostly to override a more general style for a specific item (local styles).

Styles can apply to types of document elements, such as headings, or certain layout tags (e.g. the <em> tag), or to user-defined classes (e.g. everything you want to highlight in a specific way). Styles are also an integral part of Dynamic HTML, via positioning and visibility attributes.

How do styles work? See next page.


firstpreviousnextlast