The Importance of (X)HTML/CSS Validation

A couple of weeks ago, I've been thinking about the importance of a website having perfectly validated XHTML and CSS. I was creating a website design, and I had noticed that some CSS3 properties caused a few errors in the validation.

There are some benefits of having valid markup, such as some SEO benefits, and the more professional look of a valid website. It's also nice seeing that green bar when you run your site through the validator.

I used to think that the w3c validator was an absolute rule to follow, but it's actually just a guideline to follow to help to improve your code.

To find out what others thought, I started a thread at Talkfreelance.com and got some responses. Here are a few of the replies I got.

Definitly stick to XHTML validation, and I would say do CSS Validation *comment out the cSS3 stuff temporarily* to make sure you didn't make any typographical errors or such. Other then that if you wanna use CSS3 that degrades nicely in older browsers go for it.
Biohaz4rd

its always best to make things comply with standards, that way you look professional and not like a learner!
zorpo

some browser-specific CSS3 implementations had caused some invalid cod
FWebDe (me)

Yes, but who cares. There is a difference between someone who can't code valid, and someone who is using a bit of CSS so those who use real browsers can get a slightly better experience.

It is totally different to say valid HTML - that, you have no excuse to get wrong (except when clients edit it haha). If the CSS invalidation is ONLY because of CSS3, or.... hmm, say IEpngfix with behavior, or expressions to fix IE min/max width - then that's fine. Is it perfect? No. But do we live in a perfect world? Not til IE goes die in a hole
rochow

Of course, there's a difference between XHTML and CSS validation

I always try to use valid XHTML, but it's okay to have a bit of invalid CSS. This is usually caused by the use of CSS3 properties and selectors. Since HTML is used for presentation of the content, and CSS is just for the design, it's more important for the content markup to be valid to get the SEO benefits.

What do you think? Is validation very important to you?

Stay Updated

Did you enjoy this post? Don't miss a single post by getting free updates!

5 Comments

  1. September 3, 2009

    I have a total of 5 errors between my css and xhtml, but I have no idea how to fix them...

  2. September 3, 2009

    Bruce Teague: I'm assuming that these are errors with your site at familycalamity.com. For the XHTML error, it seems that the ID of 'current' is used more than once. In HTML, IDs can only be used once on a page, Try changing it to class, and changing the '#' for the selector in your stylesheet to a '.'

    For the errors in your CSS, I don't have time to look through it right now, but in the validator, it should show which files have the errors, and you can send them in an email attachment to eric@fwebde.com so that I can have a look at them.

  3. September 10, 2009

    The default wordpress theme can not pass the xhtml validation.

    • September 10, 2009

      Britney Jean Spears: I checked it out, and it seems that there is one error in the validation. However, if you would like to use the default theme, and it's also important to you to have perfect XHTML, the error is in the template code, and can be fixed quite easliy.

Trackbacks/Pingbacks