You are here:

  1. Manual
  2. Development
  3. Cascading Style Sheets
  4. Testing CSS

Cascading Style Sheets: Testing CSS during construction

Testing CSS in web browsers

A proven technique for testing CSS during website construction is to use a standards-compliant web browser; a web browser from the first group, like Mozilla, Firefox or Safari. These browsers usually display the visual effects of CSS most consistently, that is, as they are supposed to look. If CSS functions properly in these browsers, the web developer can then test in browsers from the second group, for instance Microsoft Internet Explorer.

Use the standards as intended and check whether the browsers support the standard correctly. If not, make adjustments to achieve the desired effect.

Using background colour and borders to detect CSS problems

One easy method for detecting the cause of an inconsistent layout is to intentionally add noticeable background colours and borders by means of the CSS background-color and border properties. The browser can then highlight how certain elements overlap, or show how wide they are.

Links and references

Checking CSS code through online services

The W3C offers a free online service that checks CSS files for web developers. This makes it easier to detect errors in the CSS code.


Web Guidelines version 1.3, November 2007.