Chapter 1
CSS Demonstration
|
You can find the latest CSS Specifications at the W3C Web-Site.
|
CSS is a language with a set of properties for defining the appearance
of a document. The CSS1 specification defines properties and a declarative language for associating those properties with elements in the document. Internet Explorer 3.0 provided initial support for CSS; this support has been expanded and improved in Internet Explorer 4.0. Understanding CSS is important for adding dynamic style to a page. (Dynamic Style is the modification of the style sheet associated with the document through a script.) The W3C Web site (http://www.w3.org) contains the latest information about the innovations and features supported by CSS. This section provides only an introduction to CSS and is not intended as a definitive reference.
| CSS On-Line provides an interactive journey through CSS. |
Style sheets are an abstraction in which the style of a document is defined separately from either the content or the structure. There are essentially three techniques available to the Web author for adding style sheets to a documentin general, each level of complexity offers greater benefits while increasing the level of abstraction necessary. The first technique is to use an inline style sheet. Inline styles are simple: the style is defined directly on the element. The second technique is to use a global stylesheet to define the style for a document at the beginning of the document. The third and most abstract and powerful technique is to use a linked stylesheet to define the style separately in another document.
Inline styles are not much different from traditional HTML. The style is directly associated with an element, and the appearance of the document cannot be easily changed. The advantage is that the amount of markup is usually significantly reduced, and HTML can be used more appropriately to provide additional context rather than just presentation. Using a global style sheet at the beginning of the document better separates the presentation from the content and allows the style and rendering of that document to be quickly and independently modified. Using a linked style sheet provides the greatest benefit by allowing the appearance of a set of pages or an entire Web site to be defined through a single file. Changing the style of the entire Web site does not require the modification of any content, but instead can be done by modifying just the style sheet file.
The term cascading in CSS refers to the ability to merge multiple style sheets to form a single style definition for the entire document. This allows the Web site's style sheet to be merged in a predictable way with the style sheet in the document, and even with an inline style.