This is a legacy document, and retained on the site in order to avoid link rot. The content is likely no longer (a) accurate, (b) representative of the views and philosophies of current site management, or (c) up to date.

Tips

Todd Fahrner's Workaround for delivering the best possible CSS

Problem: CSS is cool, but if you take full advantage of it, it blows up in IE3 and NS4, with some major glitches even in IE4. How to get around the hump? One way is to write separate stylesheets for each implementation, and serve each with a script. This is tedious, and tends to encourage workaround coding, which will turn buggy behavior into "legacy support issues."

Caveat from the author, 1/9/98:

Note: MacIE4 will fetch all linked/imported style sheets before it proceeds to mangle your pages, so the "@import" workaround [sic] offered below is now defunct. This leaves SSI as the only reliable way to withhold CSS from substandard implementations, which, in, turn, means that Web authors who don't have access to their server configuration are up a creek.

Here's another, simpler idea:

Write full stylesheets using the spec and the best implementation currently available (IE4) as guides. Don't worry about support problems in IE3/NS4. When you're ready to publish, separate out the small set of IE3/NS4-safe features into a separate "primary" sheet. Link your HTML documents to this sheet. From this primary, reference the remaining declarations in a secondary sheet via "@import". IE4's the first implementation that will cascade in the "dangerous" secondary sheet. If necessary, include IE4 "crutch code" in the secondary via server-side include.

This will serve as much CSS as is safe to all three major CSS implementations, without scripting, redundancies, or excessive bug-coddling. If enough people do it, it will serve as a discouragement to the release of further buggy implementations, as the Web will become populated with enough "style bombs" hiding beyond "@import" lines. Let's face it: none of these browsers would have been released had enough CSS been in use on the Web. This strategy could break the vicious cycle of developer neglect and authorial caution.

Reprinted with author's permission.

Addendum:

You needn't do anything as complicated as I described to take advantage of this stratagem. It can be as simple as substituting the usual:

<link rel="stylesheet" type="text/css" href="mypath/style.css">

…in the head with:

 <style><!--@import url(mypath/style.css);
 
["safe" declarations optional here]
--></style>

No first-generation CSS implementation [except Mac IE4] (IE3, NS4) will get "style.css".

Summary: Link to an external stylesheet, and then import others from there.

Problem: CSS is cool, but if you take full advantage of it, it blows up in IE3 and NS4, with some major glitches even in IE4. How to get around the hump? One way is to write separate stylesheets for each implementation, and serve each with a script. This is tedious, and tends to encourage workaround coding, which will turn buggy behavior into "legacy support issues."

Sue Sims