
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.
CSS: Striving for Perfection
Nobody's Perfect
Browser implementors? Imperfect. Authors? Imperfect. Reconciliation of imperfections? Maybe… The browsers often used for rendering CSS pages vary widely in their support of both the CSS1 and CSS2 recommendations. (1) Fortunately, there is a handy reference grid (2) for determining what properties are supported in CSS1. Unfortunately, there is not yet a complete reference for support of CSS2.
Now that you've memorized that handy grid, what if you really want to declare rules on properties that are noted as 'unsupported', or 'buggy'? Our own Bugs and Workarounds document may help some. An additional source of help is the Stylesheets newsgroup which includes regular posters who have already experienced the worst implementation releases (IE3), and the best (Opera 3.6), and can usually tell you whether to give up hope entirely, or suggest minor revisions which will allow the best possible rendering for all browsing situations.
But, you splutter, that sounds like bad news. Where is the good news? Read on…
HTML Validation
Whilst it isn't exactly 'Good News', making sure that your HTML validates is a good first step in assuring maximum potential for rendering of your CSS suggestions. There are three syntax validators worth mentioning and available on-line, and at least one that can be used locally in a Win environment, that I would recommend:
-
Page Valet
from Nick Kew. (note: if you are validating an XML based document, you will not benefit at all from the 'extended report' option, that one is to be used with HTML documents only) -
HTML Validator
from the Web Design Group. Maintained by the same admin as the Page Valet above, and both of these validators makes use of the same user friendly error message library. -
W3C
Validator
from the "official source" of HTML (note: a bit dry on error reports and does not always work on line, visavi name based www hosts) -
A Real Validator
by Liam Quinn (of WDG fame) is downloadable, and reasonably priced, for those who are unable to validate online but still think they would benefit from a syntax check of their documents. (note: "A Real Validator" requires MSIE4+ to be present on your system in order to work as expected, but still offers a fully user configurable Win based interface to nsgmls )
There are other tools for checking (or linting) your HTML markup; sometimes these tools advertise themselves as 'validators', or include 'validation' or 'validator' in their name.
That's unfortunate, as well as untrue. A tool which advises you
that an unclosed <P>
may cause problems in the
Yadda Yadda browser is not a validator; validators don't give
advice -- they report errors.
A validator uses the specific "Document Type Declaration" which you add in your HTML markup to find and include a "Document Type Definition" into your document before it starts to check the syntax of your markup against that definition. Any discrepancies between your HTML markup and what is stated as correct syntax in the external DTD will be reported as an error, nothing more, nothing less.
CSS Linting
The logical step after validating your HTML is to check that your CSS rules are valid. The way to accomplish that is to use one of the online CSS Lints.
- CSSCheck by Liam Quinn; checks whether your CSS rules are 'legal' from the standpoint of CSS specifications.
- The W3C CSS "Validator" issues errors and warnings based on the legality of your rules with the CSS recommendations.
These tools are not validators, but their use is important to ensure that your CSS is correct, and can therefore be correctly interpreted by CSS aware browsers. They differ in several ways. (3)
As Good as it Gets
Validated HTML, with error-free CSS suggestions is as good as it gets. As long as there are non-CSS browsers being used, and as long as there are buggy CSS browsers being used, you are not likely to get pixel perfect control over the rendering of documents you have authored. Even if all deployed UAs were perfect, total author control is not an option. As long as users can disable CSS support, or author their own style rules to override those you have made … the user has the final say in how pages are rendered. Accept that, and your CSS experience will be less frustrating, and more satisfying. Craft the best CSS you can, and be content.
Related Links
Other HTML checkup tools
- HTML Tidy
- Bobby on (accessibility)
- Site Inspector
- Dr HTML
- Backwards Compatibility Viewer
- CSE 'Validator'
Miscellaneous
- Four reasons to validate your HTML
- Choosing a 'DOCTYPE'
- SGML Catalog for W3C
- HTML 4.01 strict DTD
- HTML 4.01 loose DTD
- HTML 3.2 DTD
- Using a Custom DTD
- The WDG's links to validators
- Real validation , an article by Liam Quinn.
Footnotes
(1) CSS 2 Recommendation .
(2) Differences explained.
-