5 Common xHTML Validation Errors

Posted in SEO , Web Development on 14 January 2010 6 comments

You can validate your website using this validation service. If you are using Opera, validating a website is just one click away : Right Click -> Validate.

Recently I have updated all my free wordpress themes to be 100% xhtml valid. After validating each of them, I found that there were some common errors, which can be solved by:

1. Adding alternate text to <img> tags

This is also known for improving your site’s SEO. Whenever you use <img> tags you have to add an alternate text. If you do not have alernate text to add, at least leave it empty like this alt=""


<img src="" />


<img src="" alt="" />

2. Closing self-closing tags

Tags like <img> , <br> , <meta> need to be self-closed.

  • <img> -> <img />
  • <br> -> <br />
  • <meta> -> <meta />

Some other self-closing tags are:

  • <area />
  • <base />
  • <basefont />
  • <hr />
  • <input />
  • <link />

3. Do not use uppercase in tags

One example, the meta verification tag given by Yahoo! Site Explorer (Yahoo webmaster tool) is always in uppercase and not self-closed, which make my page invalid.

You have to manually change the word “meta” to lowercase and self-close the meta tag.

Given by Yahoo! – invalid

<META name="y_key" content="xxxx" >

Edited to make it valid

<meta name="y_key" content="xxxx" />

4. Validating inline javascript

If you have javascript codes in your page, you have to make it valid as follow:


I will output "Hello world!" using javascript.<br />
<script type="text/javascript">
document.write('Hello world!');


I will output "Hello world!" using javascript.<br />
<script type="text/javascript">
document.write('Hello world!');

By adding cdata tag, you can make your inline javascript codes to be valid. If your javascript loaded from external js file, it will not make your page invalid so you do not have to worry about that.

5. Validating video/embed codes such as youtube video

By default, the embed codes given by youtube are not xhtml valid.

To make it valid, you can refer to the guide I wrote on last month.


Posted by Zen on 14 January 2010 • 16,967 visits 6 comments
Tags :

or Subscribe to specific category only :


Fuad NAHDI says:

Excellent guide. Thanks alot.

Rifki says:

Good information, i will wait for your next XHTML Tutorial.

Thank you.

julegaver says:

Thank you for writing this, it was quite handy and showed me quite a bit

Welcome says:

Too many compmelints too little space, thanks!

verification says:

Ola! Zenverse,
Speaking of which, XHTML is the big in-thing in web designing these days. It is the fastest growing trend that has now become a highly sought after service. So what is XHTML, and how does it guarantees browser compatibility? Let us study it in some detail.


  1. Tweets that mention 5 Common xHTML Validation Errors | ZENVERSE -- Topsy.com

Leave a Reply

You must be logged in to post a comment.

Previous Post
Next Post