User Stylesheets in CSS

Introduction

User stylesheets are an exciting feature of Cascading Style Sheets (CSS). In CSS, the presentation of a document is controlled by the combination of user and author style preferences. This mechanism is needed [text only] to allow CSS to describe fully (and then extend) the current behavior of browsers. Early implementations of CSS did not support user stylesheets. However, newer browsers, such as MS Internet Explorer 4.0+, Opera 3.50+, and hopefully Netscape Navigator 5.0 (based on the Mozilla project) all support user stylesheets.

The interaction of user and author stylesheets requires stylesheets to be well behaved in certain ways. The main purpose of this document is to explain what a good user stylesheet is. I will also try to comment on what good author stylesheets are. Some of this discussion involves discussion of specific properties, while some is more general. Finally, I will address bugs in browsers' handling of user stylesheets.

Since user stylesheets have not been used very much, many of the complex issues of good style are not fully understood. Here I present my opinions on good style. These may change as I and others understand more about cascading. Some people have argued that author stylesheets should specify all styles relevant to the layout of the document, since author and user stylesheets cannot interact gracefully. (See, for example, Braden McDaniel's post in c.i.w.a.s.) By traditional design standards, this may be the best solution. However, I think the cascade can lead to attractive design (although probably not as good as complete author control or complete user control) and certainly to more usable presentation of information.

This guide assumes prior knowledge of CSS. If you don't already know the basic syntax of CSS, you will probably have trouble understanding this guide. If you don't know CSS yet, I recommend one of the many tutorials on CSS. Furthermore, this guide isn't very practical, in that some of its advice conflicts with workarounds needed to avoid triggering bugs in older browsers.

Status

This document is still under construction. It may reach a stable state at some point, but it isn't anywhere close yet. Many of the sections aren't even written yet, so there aren't any links to them in the contents. Don't email me to tell me that the pages are missing. I also may, at some point in the future, include "Next" and "Previous" links for those who like to read linearly. Right now, I'm not sure of the order I would recommend.

Contents

Acknowledgments

The main stylesheet used in this document is the Swiss stylesheet from the W3C Core Styles.


Valid HTML 4.0!

(Up to CSS, David Baron)

LDB, dbaron@dbaron.org, 1999-08-11