3

Possible Duplicate:
What's the point of valid CSS/HTML?

This is a over-asked question, but I'm going to ask anyway.

How important is site/code validation?

I'm not referring to code errors that would break a site layout, like forgetting to close a tag, or using an unsupported tag. Just general warnings and tag usage errors.

I used to make sure my sites were validated 100%. No questions asked. Lately, I have not taken that approach however, especially with the use of HTML5. I feel that it is more important to make the site function as needed, even if it means putting a <p> tag within a <span> tag. Also, some of the CSS validation rules are pointless I feel. They are more considered with saving every possible byte then code readability.

Does it really matter? Looking for thoughts/concerns/opinions/links to articles. Thanks!

Community
  • 1
  • 1
Chris
  • 4,762
  • 3
  • 44
  • 79
  • 3
    Do you mean W3C validation? If it's that, then validation helps to ensure your code does not break in browsers that support all the features of the W3C standard. Most browsers have added their own tags for more functionality, so the fact your code passes W3C validation does not mean it will not break in some browsers. – afaolek Jun 22 '11 at 16:59
  • 2
    Could you add some examples of pointless CSS validation errors? – Paul D. Waite Jun 22 '11 at 17:00
  • 2
    Helped me in troubleshooting broken layouts. – gutierrezalex Jun 22 '11 at 17:01
  • For CSS, usually I have errors for using browser specific code, such as the asterisk(*) for targeting IE7, or -moz/-webkit calls. – Chris Jun 22 '11 at 17:12

3 Answers3

4

I do it for Peace of Mind.

When code is valid, it's more likely to work with a compliant browser. In theory, just because I test it and it works in various browsers today, does not mean it will work in newer browsers tomorrow. Standards Compliance solves that issue because if it follows the "Standard" today, it will follow the "Standard" tomorrow... of course, assuming that new browsers continue to support the Doctype you've selected to standardize against.

Why Validate - W3C

Sparky
  • 98,165
  • 25
  • 199
  • 285
2

From W3C itself, here's a "Why Validate?" page that is extremely helpful: http://validator.w3.org/docs/why.html Some of the main points:

  • Validation as a debugging tool
  • Validation as a future-proof quality check
  • Validation eases maintenance
  • Validation helps teach good practices
  • Validation is a sign of professionalism

Edit

The biggest reason I think is that when you don't validate, you're catering to broken browsers instead of designing for the browsers that do it right. Chad recently quipped that "if you use a degraded browser you deserve a degraded experience", and I think he's absolutely right. Design perfectly valid markup for standards-compliant browsers, and if absolutely necessary use IE6-specific stylesheets and the like for broken browsers. This way, you don't break the standards-compliancy of the good browsers, but you can "cheat" for the broken browsers.

Edit 2

The best exception, I think, is when you're moving forward instead of backwards. When you move backward, use separate stylesheets that only load for broken browsers - that way the good browsers aren't affected. But when you're moving forward (e.g, using CSS animations with vendor-branded tags, etc) you know that someday those will become standards (well, most of the time).

Community
  • 1
  • 1
Thomas Shields
  • 8,874
  • 5
  • 42
  • 77
1

HTML5 is the culmination of our loose and sloppy HTML periods then overly-anal and pedantic semantic XML compliant xhtml period.

Which led us to an overall "validation is really important, but let's be pragmatic about it."

As stated, valid html is easier to debug, so there's the big plus right there. But there's plenty of room for exceptions as well. As long as you aren't using laziness as an excuse to allow for invalid markup when needed, it's probably a pragmatic decision.

DA.
  • 39,848
  • 49
  • 150
  • 213