HTML and CSS Validation: Should You Validate Your Web Page?

Using a validator to check the code and links on your website


HTML and CSS Validation: Should You Validate Your Web Page?

by Christopher Heng, thesitewizard.com

If you don't hang around webmaster circles, you may not realise that HTML validation and CSS validation are controversial issues with some people. This article discusses some of the positions taken in these discussions to provide some perspectives on issues that have come increasingly to the fore in web development. Hopefully, the article will also provide a practical method that overworked webmasters can use to improve their website.

Note: if you are not sure what HTML and CSS mean, please read What are HTML, CSS, JavaScript, PHP and Perl? Do I Need to Learn Them to Create a Website? before continuing. Otherwise you'll be completely lost here since I assume you at least know what these terms mean.

Some Background Information: What does Validating HTML or CSS Mean?

For those who are unfamiliar with what validating a web page (ie validating your HTML or CSS code) means, it basically refers to using a program or an online service to check that the web page that you created is free of errors.

In particular, an HTML validator checks to make sure the HTML code on your web page complies with the standards set by the W3 Consortium (the organisation that issues the HTML standards). There are various types of validators — some check only for errors, others also make suggestions about your code, telling you when a certain way of writing things might lead to (say) unexpected results.

The W3 Consortium has its own online validator which you can use for free. It may be found at: http://validator.w3.org/

A CSS validator checks your Cascading Style Sheets in the same manner; basically, most will check them to make sure that they comply with the CSS standards set by the W3 Consortium. There are a few which will also tell you which CSS features are supported by which browsers (since not all browsers are equal in their CSS implementation).

Again, you can get free validation for your style sheets from the W3 Consortium: http://jigsaw.w3.org/css-validator/

There are numerous other validators around, both free and commercial, focusing on various aspects of ensuring that your code will run trouble-free across browsers and platforms. You can find a list of free ones (including specialised validators like those that check your code for accessibility) from Free HTML Validators, CSS Validators, Accessibility Validators at http://www.thefreecountry.com/webmaster/htmlvalidators.shtml

Note that validating your web page does not ensure that it will appear as you want in various browsers. It merely ensures that your code is without HTML or CSS syntax errors. Ensuring that your code appears correctly in different browsers require cross browser testing. You can read more information about how to do this even if you only have one computer from the article How to Check Your Website with Multiple Browsers on a Single Computer at http://www.thesitewizard.com/webdesign/multiplebrowsers.shtml

Why Validate Your HTML Code?

The proponents of HTML validation (and CSS validation, of course) say that there are a number of reasons why you should validate your code:

  1. It Helps Cross-Browser, Cross-Platform and Future Compatibility

    Although you may be able to create a web page that appears to work on your favourite browser (whatever that may be), your page may contain HTML errors (or CSS errors) that do not show up with that browser due to an existing quirk or bug. Another person using a different browser that does not share that particular bug will end up viewing a page that does not show up correctly. It is also possible that later versions of your browser will fix that bug, and your page will be broken when people use the latest incarnation of the browser.

    Coding your pages so that it is correct without errors will result in pages that are more likely to work across browsers and platforms (ie, different systems). It is also a form of insurance against future versions of browsers, since all browsers aim towards compliance with the existing HTML and CSS standards.

  2. Search Engine Visibility

    When there are errors in a web page, browsers typically try to compensate in different ways. Hence some browsers may ignore the broken elements while others make assumptions about what the web designer was trying to achieve. The problem is that when search engines obtain your page and try to parse them for keywords, they will also have to make certain decisions about what to do with the errors. Like browsers, different search engines will probably make different decisions about those errors in the page, resulting in certain parts of your web page (or perhaps even the entire page if your error is early in the page) not being indexed.

    The safest way, it is held, is to make sure that your web page validates error-free. That way, there is no dispute about which part of your page should be scanned for keywords and the like.

  3. Professionalism

    Even if you test your web site with all the various browsers in existence on all the platforms in use (Mac, Linux, Windows, FreeBSD, etc) and find that it works perfectly in all, errors in your site reflect poorly on your skill as a web developer.

    The issue is two-fold: firstly, a poorly coded web page reveals that either the web designer does not know his stuff or is a sloppy worker; secondly, it affects his marketability.

Why Not Validate?

Those who are against a blanket rule about validation often cite the following reasons:

  1. Validation is No Guarantee that Page Works

    Even if you validate your code, you still have to test it in the various browsers. Having code with no syntax errors does not mean that the HTML or CSS code does what you want. Hence some of the proponents of this view argue that the main goal when designing a web page is to make sure it is viewable and usable by your visitors, not some esoteric goal of standards compliance.

  2. Time Constraint for Conversion

    In an ideal world, you want all your pages to be usable and error free. In the real world however, many web designers with thousands of existing pages will be hard-pressed to find time to convert all those pages so that they validate correctly. Since these pages are already doing well on the web, both with existing browsers and search engines, time is better spent doing work that is actually productive.

  3. The Average Visitor Does Not Check Your Source Code

    Against the argument about professionalism is the counter-argument that the average visitor to your site is not likely to go around your site viewing the source code to your pages in an effort to locate HTML or CSS errors. To the visitor, how the page appears in his/her browser is the true test of the web designer's skill.

One Possible Solution

Like some web designers, I started designing web sites long before I realized that there were tools that could validate my pages for correctness. By the time I started validating and correcting my pages, I already had hundreds of existing pages that I needed to correct, including pages on thesitewizard.com and thefreecountry.com.

My concerns were primarily cross-browser and cross-platform compatibility as well as search engine indexability. I didn't want an error on my pages that I might miss seeing with my browser but that creeps up in other browsers, systems or the search engines. However, the problem was that converting hundreds of pages is not exactly my idea of a pleasant day's work.

I decided to take the approach I saw on a website. If I remember correctly, I think it was the W3 Consortium's own website that mentioned this method. At that time, they had a notice stating that they knew that not all their pages complied with the standards. However, all new pages they created will validate correctly, as will any old pages that they updated.

I realise that this is not the "ideal" that some webmasters argue for; but it is a practical solution for a web designer with many existing pages. If you are in the same boat, with too many existing pages to contemplate revamping everything, you might want to consider taking this route. It may not salve your pride (ie, the craftsman's pride at producing a perfect work), but at least it will help you cope with the workload.

How Often Should I Validate?

Some people validate every time they make a modification to their pages on the grounds that careless mistakes can occur any time. Others validate only when they make a major design change.

I always validate the template for my pages when I make a major design change. I try to validate my pages each time I make modifications, although I must admit that I sometimes forget to do so (with the occasional disastrous consequence; Murphy's Law doesn't spare webmasters).

I find that having an offline validator helps to make sure that I remember to validate: having to go online just to validate my pages tends to make me put off validation till later, with the result that it'll occasionally get overlooked. For those not familiar with the terminology I use, when I say "offline validator" I simply mean a validator that I can download and install in my own computer so that I can run it on my pages without having to go to the W3 Consortium's website. You can find offline validators on the free validators page I mentioned earlier, that is, http://www.thefreecountry.com/webmaster/htmlvalidators.shtml

The HTML Tidy validator (listed on that page) is available for numerous platforms (including Linux, Mac, Windows, etc) and has proven helpful to many webmasters the world over.

Conclusion

Validating your HTML and CSS code for standards compliance has certain benefits: it protects your pages from problems arising from syntax errors in your code due to different ways of interpreting errors by the search engines and other browsers. If, however, you have a large number of existing pages that have not been validated and corrected, but nonetheless work well in search engines and other browsers, you might need to consider some sort of strategy (such as the one I used) to prevent webmaster-overload.

This article can be found at http://www.thesitewizard.com/webdesign/htmlvalidation.shtml

Copyright 2003-2012 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from http://www.thesitewizard.com/.

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to thesitewizard.com newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at http://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce this article in whole or part, in any form, without obtaining my written permission.

Related Articles

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

HTML and CSS Validation: Should You Validate Your Web Page?





Home
Donate
Contact Us
Link to Us
Topics
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Domains
Web Hosting
Blogging
JavaScripts
PHP
Perl / CGI
HTML
CSS
.htaccess / Apache
Newsletters
General
Seasonal
Reviews
FAQs
Wizards

 

 
Free webmasters and programmers resources, scripts and tutorials
 
HowtoHaven.com: Free How-To Guides
 
Site Design Tips at thesitewizard.com
Find this site useful?
Please link to us.