Validate your Web Pages

What is Validation?

Due to advances in technology and accessibility, it is important that you validate your web pages. The W3C’s Markup Validation Service is a free service that checks and verifies your HTML, XHTML, CSS, etc so that it meets current web design standards. Having valid code on your page makes sure you haven’t misspelled or mistyped anything (or much) and it will help guartanee that your pages will work in “all” browsers. However, you may need to add some hacks so IE 5 and 6 render your CSS correctly; those hacks will NOT validate. You must make a choice. Either way, it is really important to validate your pages if you want a quality web site, and you want a quality site that will draw visitors, right?

Start with a Doctype

Make sure you have a document type definition in your XHTML or HTML pages. This tells the validator what standards to use. YOU set up the standards you are using by adding a doctype. This code is usually the very first line in your web page. It goes above the html tag.

HTML 4.01 Transitional:

< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

HTML 4.01 Strict:

< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

XHTML 1.0 Transitional

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML 1.0 Strict

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.1

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

XHTML Mobile

< !DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

HTML Specification

In your HTML opening tag, add the following specification.

Character Encoding

Add a META tag inside your body tag that indicates what language you are using in your web page.

Use the W3C’s Validation Service

Next, you upload your file to the validtor webpage or state the URL of your file in the validator web page.

W3C Validation Service

Once you hit the Check button, the web site will go through your code and check to see if your code correctly validates with your doctype. If you do not specify a doctype in HTML, then it will throw that error and validate according to its default doctype. If you have errors, the page will return a detailed list complete with line number. Use this information to fix and improve your code to make it more accessible and usable across different browsers.

W3C Validation Service

You can then recheck your pages to update the error list or to see if all your fixes are valid, too.

W3C Validation Service

If everything is valid, you get a nice congratulatory message.

W3C Validation Service
This entry was posted in Web Design, Web Design Best Practices and tagged , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">