What does it do?
Test whether webpages are built properly using Cascading Style Sheets (CSS).
Why is it important?
Stylesheets (also known as CSS, or Cascading Style Sheets) are a standard means of building webpages that delivers massive benefits over the previous ‘table-based’ technique, including:
- Faster to load
- More accessible
- Easier to maintain
Since 2001, it is virtually unheard of for a website not to use stylesheets. However, this test checks that pages are built using it properly for layout, and not just to perform cursory functions (such as change font size).
How is it measured?
Each page is analyzed in turn to determine whether it uses CSS, whether tables are used for layout, and whether external stylesheets are used. The score is calculated from the proportion of pages which use CSS for layout, with a very slight preference for using external stylesheets. The relative Importance of each page affects how the scores are weighted.
Pages with virtually no content (e.g. redirection pages) are ignored.
The test compares <div> and <span> tags, styles applied to them, and <table> tags. A complex algorithm weighs these factors and determines whether the page is using a CSS layout or not.
Usually the hierarchy of elements is a good indicator of whether a page is built using CSS. For instance:
Is usually a CSS layout, containing a table, whereas:
Is usually a table-based layout containing CSS. These are simple generalizations, the algorithm we use is more sophisticated.
The algorithm (and indeed the problem) is not exact. There exists a very small number of pages for which a human being would struggle to say whether the page is using CSS or tables for layout (for example, pages where the layout is largely in CSS, but another web designer subsequently added extensive regions in tables). These instances will tend to err in favour of a positive CSS result.
How to improve this score
Make use of CSS for the layout of pages. If this is not already the case, this usually requires a complete redesign, and can be quite difficult.
How to use this test effectively
Use this test to understand whether or not a website is built using CSS, and to ensure that all new websites are built entirely using CSS.