Tuesday, January 29, 2008

Validate your website or not?

The days that IE was number one browser has gone and new players appears. Websites are not Microsoft FrontPage
babies that works properly only in IE. The effort that a web designer have to make to create a well done website that follows the web standards but at the same time works on multiple browsers have increase.

I have read a lot of articles about the importance of validating the HTML and CSS code of your site and found that it is not so “important”. I don’t say that you don’t need to do it, but sometimes it’s difficult to apply the web standards to your website. The most important thing is to make your site to work on multiple browsers: Firefox and IE (at least on version 6 and 7). If you archive this it will be ok for your visitors.

But if we analyze in more depth the importance of validating your site you will have the following benefits:

Your site will be working on multiple browsers (not absolute). I found that making your site behave normally in IE you will need a little more effort. Sometimes you need to write a different CSS for it and include it in the following tags:

Internet Explorer browser display forms, text fields, buttons and some form elements a little different than Firefox. Especially you will discover the IE always put a padding to your form for no reason. To fix this you will have to write the following CSS code:

Also, if you apply border styles to your button or text field you will have to play with their height because IE displays them different than Firefox.

Fewer strange problems. Less problems with text align and padding issues. For example, if you make a page and don’t give text-align properties to it you will find that Firefox align the text on left and IE align the text on the center. So you will always have to give text-align properties in your CSS:

text-align: left; or
text-align: center; (there are more options: right, absolute…)

Search engine friendly site. If your code is clean and follows the web standards the search engine crawlers will be able to analyze in more depth your site and get more information, otherwise they will leave on the first bad code.

Discover and recover broken links. I think i don't have to analyze that point, it's obvious.

Be more professional. If you learn to write clean and validated code then you will increase your web design abilities, save a lot of time and effort from try to validated your site, use useless code will be a history and generally you will be more proud about your work.

Some useful links

HTML Validator
CSS Validator

I make a search to see which of the most popular site are HTML validated (XHTML 1.0 strict) and found the following results (Top 10 sites from Alexa.com):
  1. Yahoo.com HTML: Failed CSS: Pass
  2. Google.com HTML: Failed CSS: Failed
  3. Youtube.com HTML: Failed CSS: Failed
  4. Live.com HTML: Failed CSS: Failed
  5. MSN.com HTML: Pass CSS: Pass
  6. MySpace.com HTML: Failed CSS: Failed
  7. Facebook.com HTML: Failed CSS: Failed
  8. Hi5.com HTML: Failed CSS: Failed
  9. Wikipedia.org HTML: Failed CSS: Pass
  10. Orkut.com HTML: Failed CSS: Failed
Only msn.com pass both html and css validation. You can see that the big players don't care too much about the web standars. They want only to make their site works on all browser (that don't mean html&css validated) and offer their products.

It is up to you to decide what is the best.

No comments: