02 January, 2009

(X)HTML & CSS Validation: Why validate your webpages?

Find out the advantages and disadvantages of validating webpages.

Depending on who you talk to, (X)HTML and CSS validation is very important. The subject is rather controversial for many webmasters. This article discusses some of the positions taken in from both perspectives of the issue that has received much attention lately. Hopefully, this article will also provide a practical method that overworked webmasters can use to improve their website.


What does Validating (X)HTML or CSS Mean?

For those who are unfamiliar with what validating a web page (ex. validating your (X)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 (X)HTML validator checks to make sure the (X)HTML code on your web page complies with the standards set by the W3 Consortium, an organization that creates specifications and guidelines that are intended to promote the web's evolution and ensure that web technologies work well together for present and future technologies. 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 most popular (X) HTML validator is the W3 Consortium's own online validator which you can use for free at http://validator.w3.org/.

A CSS validator checks your Cascading Style Sheets in the same manner. 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 at http://jigsaw.w3.org/css-validator/.

Although validators find errors in your page's source, they do no 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. To ensure that your website appears as you want in various browsers, you should test your site in Internet Explorer and Mozilla Firefox, and in Netscape if you desire.


Why validate your (X)HTML and CSS Code?

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

    Even if you code your website to work properly in your favorite browser, a friend of yours or any other visitor to your website may be using a different browser. All browsers don't render pages equally, so your site may not appear in their browser as you had hoped. Your site may appear as you want it to in your web browser with bugs. If these bugs are fixed in later versions of your browser, your site may no longer appear as you want it to.

    Coding your pages so that it is correct without errors will result in pages that are more likely to work across browsers and platforms. 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.

  3. Professionalism

    Even if you test your website in all the various browsers in existence on all the platforms in use and find that it works perfectly in all, errors in your site reflect poorly on your business or site and your skills as a web developer.


Why Not Validate?
  1. Validation Is No Guarantee that Page Works

    Validation does not guarantee that a page will appear as you want it to in all browsers. After validating, the site's pages still must be tested in various browsers to guarantee that the page works in most browsers. This is the major dispute against validation as some see it as a waste of time.

  2. Time Constraints for Conversion

    Most website developers don't learn about web standards and validation when learning (X)HTML and CSS. Converting takes time that many say they simply don't have. (To solve this problem gradually, start out by only validating new pages and pages that need updated.)

  3. Most Visitors Will Not Care

    Depending on the target audience of your website, most of your visitors will not care whether or not your website's pages validate or not. To the visitor, how the page appears in his/her browser is the true test of a web designer's skills.

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 different 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 should undergo a gradual transition by validating new pages and pages that need updated as you see fit.

Source: www.depiction.net