The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Validation: It’s your cross browser compatability friend! Re: Validation: It’s your cross browser compatability friend!


Keep in mind…

— #1: No, not everyone knows to validate. CSS-Tricks has a lot of visitors who are learning web design for the first time. Seasoned web designers know to validate. Beginners often don’t. Validating will help teach them the right way to code, and hopefully remove some frustration when things aren’t displaying like they should.

Validation — especially for beginners — is important because it is an easy way to catch problems with the code. If the code is valid, it helps with cross browser compatibility. It’s a heck of a lot easier to deal with browser quirks if you have valid code to start with.

— #2: This depends what doctype you are using. And yes, to respond to your specific example: it does understand the <script type="text/javascript"… etc bit — this validates just fine:



and it also validates just fine when using "<script type="text/javascript" src="anyscript.js" />". Technically, if you are using XHTML, which uses "/>" endings, you probably should be using "<script type="text/javascript" src="anyscript.js" />".

In most cases, you aren’t supposed to be using empty tags anyway, so this shouldn’t be an issue.

— #3: Yes, well, do all browsers support the role attribute? No. Then it’s a non-issue, and you can’t feasibly use it anyway. Remember, IE6 and 7 can’t actually display XHTML as real XHTML anyway — it is served as text/html, rather than true XHTML. (Things to keep in mind:, and … _properly/). Besides, if XHTML is properly served by the web server as XHTML, any errors in the page will break the page. Well-formedness errors are fatal. (Validation is just spell checking? Doesn’t seem like it.) In that case, you’d better validate, otherwise your page won’t show!

— #4: Web designers/developers can get lazy. Just because other sites don’t always validate — even the WC3 — is no reason that your own sites can’t/shouldn’t, especially when most validation errors shouldn’t be an issue if you are coding according to the HTML/XHTML rules anyway. (And, as far as I can tell, the does use valid code).

All this being said, validation isn’t perfect. There are times — as an experienced web designer — when you can, and perhaps should, break validation. However, if you know what you are doing, and you aren’t being lazy, you shouldn’t run into many significant validation errors anyway.