开发者

Is W3C validation important? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible开发者_运维百科 Duplicate:

How important is W3C XHTML/CSS validation when finalizing work?

I read about validation from many sources and most will say always validate your web page. It is important that your page validate.

I understand the concept. But my site does not "validate", yet it works across every major browsers, does not produce errors in those browsers and looks correct in all browsers.

This is an example of an error I get

Error Line 38, Column 28: document type does not allow element "h3" here

var $jsuccessmessage = "<h3>We will be in contact soon. </h3>"; // success mess…

The element named above was found in a context where it is not allowed. This
could mean that you have incorrectly nested elements -- such as a "style"
element in the "body" section instead of inside "head" -- or two elements
that overlap (which is not allowed).

So I ask, how important is it that I correct these errors and do my best to produce fully validated code?

Note: I am using XHTML 1.0 Transitional for my doctype.


Proper markup is pretty important. Just because some invalid markup works in all of the current versions of the browsers you care about doesn't mean that it will keep working in future versions. As long as there is some competition in the browser market, the browsers tend to get closer to the standard and non-standard HTML has a higher chance of failing in interesting ways.

Sticking to the standards helps you future proof your work and it helps you build good habits.

Consider how many large organizations are still stuck using IE6 (yes, 6). Why are they stuck with it? They are stuck with it because they had a suite of critical applications built that only work on IE6 due to non-standard HTML, CSS, JavaScript, ActiveX, etc. These poor people are stuck with a pile of creaky ancient applications that can't be updated without paying for a complete rewrite. If they built to standards in the first place (with hacks and kludges to account for the ever present non-standard behavior), it would be easier to move forward a little bit at a time.

Everything you build that is non-standard anchors you in the present and leaves you stuck in the past next month. There's no good reason to wear concrete boots when surfing and even less reason for your clients to wear them.


I was reading Steve Saunders' book on high performance website. He mentions many tips & tricks that offend W3C validator but speeds up the page and in turn delivers a better user experience. Better user experience will bring me better revenue so I, as a business owner, would love better user experience. On the other hand, incompatible, standard or best practices defiant systems demand more maintenance and attention. So I, as a developer, would love a standard compliant page. Choose your position wisely and you will find a middle path. Please do not take my comment as standard compliant pages provide lesser good user experience. There is no silver bullet as they say. I dont know them but they seemed to be right.


You should use W3C conventions as much as possible and these convention are going to be the most cross-browser compatible. That being said not all browsers implement W3C standards properly or completely. You will find that you have to break compliance to adjust for these quirks. It is not as bad as it used be, as the main culprit, Internet Explorer has been more accepting of standards.


The importance of validation is a matter of personal opinion. Sites don't need to comply to W3C standards to work across browsers.

It's kind of like driving, some people don't obey the laws and get away with it. Eventually it will catch up to them. It's much the same with validation; the risk of invalid code is poor SEO performance, future browser incompatibility, etc.

Having valid code is just "the right thing" to do, and is encouraged by most developers that I know.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜