How to Make Sure Your Joomla! Site Validates

Making sure your website is standards compliant can sometimes be a bit tricky. The problem is made worse when you rely on third party software which generates HTML you may never see.
Three major factors come into play when keeping your Joomla! site compliant and I will detail them below.

First and most important:
Make sure that the template that you use is standards compliant.
If you are purchasing a template from a third party then ask them to make sure that their template is designed to be valid XHTML / CSS. If it's not then it is probably not worth the money.

If you are designing a template yourself then there are two main things to remember:

  • Don't use proprietary CSS properties like "-moz-corner-radius". Not only are they not valid CSS but roughly half of the web-going population will never see the benefits.
  • Don't use CSS hacks. CSS hacks like putting and underscore in front of a property to make it IE specific break your CSS compliance and make you lazy.
    There is always another, standards compliant, way to get the same effect, you just need to look for it!
  • Make sure your markup is XHTML compliant. I recommend XHTML compliance instead of HTML compliance because it forces you to be stricter with your syntax, which in turn will make sure that your code is cleaner in the future.

Second:
Which modules are you using?
To the best of my knowledge all of the core Joomla! modules are XHTML / CSS compliant, however, you will not be so lucky with third party modules.
Making sure that you only use modules that validate can be difficult but it is worth the effort. If a module is designed specifically to be standards compliant then it implies that the code will be of a higher than average quality. Developers who don't bother with standards compliance are either lazy, ignorant or simply don't design with web standards in mind. None of those things are good indicators of the quality of their workmanship.

Hacking modules into compliance, as a last resort, is generally not too hard.
However with a large component / module / plugin like Virtuemart you are probably better off making a complaint to the developer. Having the developer make their base code standards compliant is a much better outcome than you spending a week hacking their code to achieve the same thing.

To check your sites standards compliance you will find these validation tools useful:
XHTML / HTML: http://validator.w3.org/
CSS: http://jigsaw.w3.org/css-validator/

In order to maintain your sites compliance I would recommend checking over each page of your site periodically.

Any time you spend on maintaining standards compliance is very much worthwhile. Not only will it ensure that your code does not become sloppy but it will make sure that as much of your readership as possible have a good experience on your site.

Good Luck!