Back to Website Launch Checklist

How and why to validate your CSS with the W3C CSS Validator

How and why to validate your CSS with the W3C CSS Validator

W3C (or the World Wide Web consortium) is the main international standards organisation for the world wide web - basically they're the ones calling the shots when it comes to HTML and CSS specifications. They make available a validation tool on their website which can assess any URL and flag up issues with the CSS - in this article we'll look at how to use this and why it's important to do so.

One thing to bear in mind with CSS validation is that it'll pretty much be impossible for any modern website to be considered 100% compliant, as it's currently necessary for developers to use a lot of non-standard CSS properties such as vendor prefixes, which will flag up as "warnings". So use the report as a general guideline, but you should by no means feel the need to adhere to every point.

Why validate your CSS?

Find bugs

Especially for new users of CSS, validation can be a great way to find any bugs or inconsistencies in your code (such as incorrect nesting or invalid properties) which could lead to all kinds of errors down the line.

Follow established best practice

If your CSS is compliant, you can be confident that it is up to scratch with the latest specification and if anyone else ever needs to work with your code, everything should be exactly as they would expect.

How to validate your CSS

Using the W3C CSS Validator

The CSS validator is extremely easy to use, you can either validate by URI (i.e. by inserting a web address), by file upload, or by copy/pasting some CSS directly into the validator. Mostly you'll probably be using the "By URI" option, so simply enter a valid web address and click "Check" and you'll be presented with your report. As previously mentioned, there will be quite a lot of warnings (and potentially a few errors) here which you simply do not want to fix, so take any reccommendations here with a pinch of salt.

Hopefully this article has helped you get to grips with CSS validation! Compliant CSS is nowhere near as important as HTML and most of the time on modern websites it's pretty much impossible to achieve. That said, in order to ensure that you're writing your CSS correctly it's worth giving it a run through, especially for new users.

  Back to Website Launch Checklist