Code quality

This test checks to see whether the website uses semantic HTML and whether or not it is is W3C compliant.

Why do we test for this?

Semantic HTML is the use of HTML markup to define the semantics (or meaning) of information in a web page, rather than how it should be displayed. It is considered best practice to use Semantic HTML to mark-up your document and then use CSS to style it appropriately. Use of non-semantic elements like <i> and <font> is discouraged.

Tables were traditionally used to lay out web pages in two columns, but since the advent of CSS and modern browsers a few years ago, it is no longer necessary to use tables for anything but tabular information. It is now best practice to create columnar layouts using divs and CSS. This also helps rendering in non-visual browsers or when a sites stylesheet is not available.

W3C is the standards body for the web, and W3C compliance is therefore a widely adopted test with many benefits. As a general rule, sites which are W3C complaint will work more consistently across web browsers, in particular new ones as they are released. They will also likely be more accessible and usable (though adoption of standards which users will tend to expect, and therefore be familiar with). They are also more likely to work on non-standard devices, such as mobile phones and televisions, which are becoming increasingly prevalent. Some search engines (notably Bing and Google) prefer W3C compliant pages.

The principles of validation generally correlate highly with good SEO (Search Engine Optimisation) practice. W3C compliance is considered one of the best assurances that the website has been built with accessibility in mind (which is a legal requirement in many countries). The UK is particularly concerned with W3C compliance.

For more reasons see:

How do we test for this?

We look for elements inside table cells which might indicate the use of tables for layout. These include divs, headings and tables. We also look for presentational tags in HTML like the font tag, the bold tag and the italic tag.

The W3C test is run on every page we test in turn.

Although you may get errors and warnings, only Errors count towards the final score.

What can I do about it?

It might not be easy, but you should convert all pages of your site that use tables for layout to use divs and CSS. Only use tables for tabular information, e.g. a table of prices. Instead of using presentational elements to format text, use appropriate semantic elements and then style them with CSS.

Use the results of the validation to fix and improve the compliance of your website. For a new site, try and make the website W3C compliant from the start as it is hard to fix a large site which hasn't been built with W3C compliance in mind.