June 28, 2004

W3C Validation Service

Has it ever happened that you make a change to your default templates or stylesheet and suddenly your weblog doesn't look right anymore? Panic begins to set in as you quickly try to undo the changes that you just made, but it's still not working? A great tool to use to help troubleshoot problems like this is the W3C Markup Validator.

valid-xhtml10.png

The World Wide Web Consortium (W3C) is the organization responsible for setting the HTML specifications and standards that browser developers use in their web browsers. If your web page "validates" then it should be able to be viewed properly in the major web browsers. If it doesn't validate, then the validator tool will list out all of the errors or inconsistencies of your code with the Doctype of HTML you are using, which in the case of Movable Type is XHTML 1.0 Transitional.

The most likely culprit for a screwy looking page is a div tag <div> that is missing its closing tag </div>. The validator can help you locate those errant div tags. The validator may also list a whole bunch of errors that are somewhat trivial; for example it doesn't like <br> line break tags, they need to be written like so: <br />. The validator is also picky about blockquotes. You have to make sure there is a blank line preceding a starting blockquote tag on a page for the page to validate.

Some people seem to get religious over having their pages validate. My view is that some pages will never validate, yet look perfectly fine in 99% of the browsers out there, so don't get too hung up on having to have every page validate. The validator is a great tool for troubleshooting, and a good place to start if your pages aren't rendering properly. The W3C also has a CSS Validator for making sure your stylesheet doesn't have any glaring errors or omissions.

Links:
W3C Markup Validator
CSS Validator
Al-Muhajabah's MT tips: a tool for validation - a great explanation of the validator.
Amputator plugin - converts ampersands to conform to valid XHTML.
Saferef plugin - searches for non-valid URLs and fixes them.
Validable plugin - "helps you create a validatable site even when your sloppy writing style and MT's line break conversion conspire against you."
March to Your Own Standard - a case against validation fundamentalism.


Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://learningmovabletype.com/ . Thanks!

Posted by Elise Bauer on June 28, 2004 to HTML and Javascript
Comments(1) | Email to a friend | Printer-friendly version


Trackback

If you would like to send a trackback
please use the following URL: http://learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/285

Comments

"The validator also doesn't like blockquotes containing multiple paragraphs."

I've not found that to be true...my blockquotes contain multiple paragraphs and lists as well and the validator doesn't say anything ;) They need to be formatted correctly of course ! eg http://blog.arvind-satya.com/archives/2004/06/new_work_rules.php

That blockquote contains a page full of paragraphs in the blockquote - ignoring all the errors (which I must correct some time soon !) the blockquote vlaidates fine !

Comments are now closed for this entry.


Email to a friend

Email this article to:


Your email address:


Message (optional):