The Mysterious World of Style Sheets
Lesson 1 - Introduction

CASCADING STYLE SHEETS are useful beasties although incomplete browser support renders them less effective at present than their potential. But, having said that, preparing for them with good html habits and beginning to use them now is highly recommended.

Basically, style sheets are composed of rules describing how you want to display various html elements on a page. These rules can be coded on each page, controlling that page, or, used as a text file referenced from multiple pages, they can maintain style and appearance over an entire site. Style sheets get the cascading designation from the cascade effect of the placement of the rules which is explained further in Part 3.

Browsers earlier than Internet Explorer 3.0 and Netscape Navigator 4.0 do not see style sheet instructions and even browsers that do see them are inconsistent in their implementation of them. Style sheets can NOT be relied upon for critical html instructions unless you are certain that your audience, such as an Intranet, is equipped with appropriate browser versions.

There are two ways to handle this difficulty and still use style sheets. One, write your pages without using style sheets, acceptable to all browsers and platforms. Then, add your style sheet instructions, choosing properties that are fully supported by the major browsers. Your site will appear well to all browsers with extra *icing* for those who can see the style sheet results. It should be noted that current web statistics indicate that only 7-10% or less of the viewers will not see style sheet enhancements.

A list of safe CSS elements
http://webreview.com/wr/pub/guides/style/safegrid.html

The other tactic for using CSS now is to use two sets of pages and a browser detection script. Older browsers will be routed to the plain old html coding and newer ones to the style sheet pages. You can improve on this further by having two sets of style sheets, one for Internet Explorer and one for Netscape. The hitch here is that a browser detection script generally uses javascript and cookies which bring their own problems. Obviously I favor the first choice, make a basic readable page and then *decorate* and *enhance* it using CSS.

GOOD HABITS to form for using CSS, now or in the future, means writing good html, including closing all tags that take closing tags, most particularly the </P> and </LI> which most browsers don't presently require to be closed. Style sheets need clearly defined elements, thus closing tags are essential.

       On to the advantages...

GOOD POINTS ..... yes, there are some!. Style Sheets offer much more control of the layout and appearance of your web page. You'll be able to specify font faces, colors, line spacing, indents, margins and more on a consistent basis across many pages. Site design, maintenance and redesign will be easier. Multiple pages can be linked to a single style sheet ensuring consistent appearance across entire sites as well as making an appearance change a matter of changes to a single file.

       Let's get started ...

NEXT ----- >

Intro
Getting Started Context/Cascade
Properties & Values Classes
Resources


© MaMaT htmlhelp.rootsweb.com Last edited on 21 Nov 1999