Learning HTML 3.2 by Examples, section 4 Fundamental structures in HTML 3.2, with examples:

Style sheets

Style sheets are not part of HTML. They can be used even in conjunction with HTML 2.0 despite the fact that HTML 2.0 contains no specific constructs related to style sheets. On the other hand, HTML 3.2 contains such constructs, and assumably future versions of HTML will have more support.

The basic idea of style sheets is to provide tools for specifying features of the visible (or audible) representation of HTML documents without introducing new HTML tags and attributes for the purpose. The presentation style is specified in a manner which allows several style specifications (by the author and by users, as well as browser defaults) to be taken into account when rendering a document. This will allow control over indentation, colors, fonts, etc in a sophisticated manner. For more information about style sheets in general, consult the W3C pages on style sheets and WDG pages on style sheets. There is also a CSS FAQ by The HTML Writers Guild. For criticism of style sheets, see my Why style sheets are harmful.

Almost at the same time as the HTML 3.2 Reference Specification was accepted as a W3C Recommendation, a recommendation with similar status was accepted concerning style sheets: Cascading Style Sheets, level 1, abbreviated CSS1. The two recommendations are, however, separate in the sense that the combination of style sheet specifications with HTML documents has not been defined exactly. In particular, CSS1 mentions the ID and CLASS attributes for selecting specific pieces of text, but these attributes are not in HTML 3.2. The same applies to attributes of STYLE element and the proposed SPAN element.

The HTML 3.2 language provides two ways of referring to style sheets in HTML documents:

In both cases you can e.g. define the visible representation of H1 elements in your documents but you cannot specify that some H1 elements are presented in some way and some other H1 elements (in the same document) in another manner. However, a browser which supports style sheets at all very likely supports some mechanisms (outside HTML 3.2) for the latter situation.

Additional methods of referring to style sheets in HTML will probably be possible, and some of them are already supported. For a short general discussion, see Linking Style Sheets to HTML by WDG. There is also a W3C Working Draft HTML3 and Style Sheets which discusses these issues.

An HTML 3.2 conforming browser need not support style sheets in any way (except by recognizing the STYLE element and hiding its contents). However, there is increasing support for some features of CSS1 in browsers.

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.