How to write style sheets (CSS)
If you wish to use
Cascading Style Sheets on Web pages,
here's a suggestion on how to do it, especially how to
solve problems or preferably avoid them.
The discussion here is limited to
CSS2 has been implemented to a small extent only.
It is assumed that you have read some introduction to style sheets,
CSS Quick Tutorial or
Adding a touch of style.
- Create your HTML document(s) according to
good authoring principles.
- When you have an idea about a presentational suggestion,
CSS Properties whether there is a property
which can be used and how it is to be used.
That way you'll find reliable information about how
it should work, by the specs.
- Check the implementation status for
the features you are going to use, from the
Master Compatibility Chart by
Note that being not supported ("N" in the table) is not that serious
but buggy ("B")
- If you decide to use CSS for your purposes, write a style sheet
according the specifications and
associate it with your HTML document.
- Check your HTML
a validator. (Naturally, you used a validator already at step 1.
You need to validate again, since you have added something to your
HTML document in order to associate a style sheet with it.)
- Check your style sheet
a CSS checker. It is practically certain that you
make lots of mistakes in your CSS code, and a checker
is therefore indispensable.
- Having done that, and having fixed the errors and re-checked your code,
see how the document looks like on some browsers.
Preferably, test it on all major versions of IE and Netscape from
version 3 onwards and on Opera.
- If problems remain, and you can't find an answer e.g. by
using the documents listed under
consider asking for help in the newsgroup
Please remember to tell the URL of your page,
check the FAQ before posting,
good Usenet style.