Cascading Style Sheets -- Style Outside of HTML

What is a cascading style sheet anyway?

Cascading Style Sheets were originally proposed in 1994 by Håkon Wium Lie, a denizen of the World Wide Web Consortium, or W3C. The first attempted widespread implementation of CSS was Microsoft's Internet Explorer 3.0 browser. The CSS1 proposal became a W3C Recommendation in December, 1996, and the CSS2 proposal became a Recommendation in May, 1998. Currently, W3C is encouraging people to familiarize themselves with styling using CSS through the Core Styles project, which provides a variety of extensively defined style sheets which are accessible by anyone. Other ways that can be used to style documents on the web are the eXtensible Style Language or XSL which is used with XML, and the Document Style Semantics & Specification Language or DSSSL which is a standard (ISO 10179), used with SGML.

HTML, being a child of SGML, is required to limit its functionality to marking up only a document's meaning or context, not its appearance. HTML 3.2, with its use of <FONT>, <CENTER> and other elements and attributes whose sole purpose is to affect the appearance of the document, was an attempt to bring HTML more in line with what browser manufacturers wanted, but the result was that it moved HTML farther away from its SGML roots. The adoption of cascading style sheets with HTML 4.0 brings HTML a big step back towards compliance with its parent language, SGML.

A cascading style sheet is a set of properties and values. Properties and values, collectively, are called a declaration which is linked to a selector, the different HTML elements to be affected. The overall effect of a style sheet is to alter the presentation of the document content in a way which is not, and should not be allowed by HTML, using a mechanism which can be embedded in a HTML document, or linked remotely, so as to be accessible by the application used to display that HTML document.

What that means in English is this: Cascading Style Sheets are either linked to HTML documents or embedded in them, but by themselves, they are not HTML or even related to HTML. Cascading style sheets are defined by their own specification, which is not a part of the specification for HTML. They contain simple text, formatting and layout instructions which are interpreted and rendered by a HTML browser, and they give a much broader range of control over the appearance of such a document once it is rendered than is allowed by HTML.

Here is an example of a simple style sheet:

H1 { color: blue }

In this example, H1, the standard first-level header element, is the selector, or the HTML element to which this style applies. The property is color and the value is blue. Together, the entire { color: blue } construct is the declaration. Text formatted with the declaration in the example would look like this:

This is sample text

and the code which formats it, assuming that the style sheet is embedded or linked properly, would look like this:

<H1>This is sample text</H1>



Made with Cascading Style Sheets