How to Make Sure Your Web Page is Standards Compliant

The World Wide Web Consortium (W3C) develops standards for the web. Most, if not all, browsers are written to comply with the standards created by the W3C. If you want to make sure that your web pages are going to work in most browsers, then you should validate your web pages to make sure that they comply with the standards.

If your page is compliant, it doesn't mean that your web page WILL work with all browsers, but your pages are much more likely to work with more browsers than if you have HTML or CSS errors in your page. Even if your web page passes validation, you should still check your pages in at least the most popular browsers.

You can validate your HTML here: http://validator.w3.org/

You can validate your CSS here: http://jigsaw.w3.org/css-validator/

You are likely to get a lot of errors the first time you run this on your pages. Usually the first couple of errors will throw the rest of the page off and make it look like you've got more errors than you really do. So, fix the first couple of errors and then run the validator again. Keep doing that until your page doesn't have any more errors.

Once you're page is valid, you will be given a W3C logo image that you can put on your web page to show others that your page is valid. I guess it's sort of like bragging rights.

You'll need to have a valid DOCTYPE statement at the beginning of your page. The DOCTYPE statement tells browsers which standard to use to display your page. This statement helps the W3C validator know which standard your page is using so that it can validate it correctly.

The DOCTYPE statement that I usually use is:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

You can see other valid DOCTYPE statements here: http://www.w3.org/QA/2002/04/valid-dtd-list.html

The validators can be frustrating sometimes. It often shows errors that may be hard to find, but I've noticed that the errors seem to be much easier to interpret than they used to be. And it often helps me find errors that I wouldn't have noticed otherwise. It's worth the effort.

Comments

  1. Cindy says

    No I haven’t. Very cool!

    Thanks Jonathan!

    Another thing I should mention is that validating web pages can help significantly with Search Engine Optimization. If you have HTML or CSS errors in your web page, it might confuse the Search Engine spiders that index your page.

Leave a Reply

Your email address will not be published. Required fields are marked *