Why you should validate your Cascading Style Sheets
by Paul Flyer
Validating CSS files ensures conformance to W3C recommendations.
So what?
Heres the deal with code even simple CSS code: cleaner means leaner and more efficient. Validation ensures the css file can be understood by the modern browsers. Being understood by the modern browser means the presentation of your website can be effectively communicated to you audience.
Validation does not mean you’ve chosen the best presentation or the coolest presentation. It doesn’t even mean that your code will present the presentation you intended! It simply means there are no obvious SYNTAX errors in your code. Validation is about the syntax. Nothing else.
However, simple syntax errors can have a serious effect on your website.
The CSS Validator checks for things like:
- Every selector bracket that is opened is subsequently closed
- Every property has a colon
- Every property ends in a semi-colon
- Spell checks standard property names and values
I had a problem once where I couldn’t figure out why a border was missing. It wasn’t until I ran it through the validator that I saw I had misspelled border as bordor. My eyes simply didn’t catch it.
In short, there are four main reasons to validate your CSS file.
- Good practice
- Heck, it is BEST practice
- Catch Errors
- Professional
[tags]css, w3c, validation, validator, webdesign, [/tags]
Be sure to review our list of recommended web tools.



