scriptygoddess

12 May, 2003

Site validation

Posted by: Jennifer In: How to's

Mark Pilgrim's recent post (why we won't help you) about using HTML validation as a way to troubleshoot layout problems (among other things) got me wondering if I could validate my own HTML. So I did – here are some tips on how you can too:

Validation means you're bringing your markup into compliance with the standards set by the World Wide Web Consortium; because I was a novice and because my main goal was cross-browser viewing compatibility, I chose to validate to the standards for HTML 4.01 Transitional. HTML is being supplanted by XHTML or eXtensible Hypertext Markup Language; if you want to validate to the most cutting-edge standards, you'll want to read more about it. Among other benefits, validation acts as the ultimate proofreader; it catches mistakes you might not find (and might not even know were mistakes) that cause your site to behave strangely in differnet browsers. If you're considering embarking upon a big site overhaul like skinning, this kind of effort is worth it, because you'll move forward with cleaner code.

The nuts and bolts of validating involve checking for and correcting errors; to do this most effectively while my main site was still live, I moved a copy of my index page to a test blog – no risk of ruining the template because my main site could serve as a backup copy. Another reason to use a test blog? You will always want to validate the source code of a live page; that's what people will see when they view your site. If you try to validate a blogging template before any PHP scripts or template tags have been processed when the page loads, the validator will give you error messages because it won't recognize the tags. When I first ran my page through the W3C HTML Validator, I discovered 103 errors. Let that sink in for a moment. Then I realized that the validator was picking up two kinds of mistakes: 1. errors in the code used for the templates, and 2. errors in the code in the entry text. Every time I corrected an error in the template code, it removed multiple instances of that error on the index page – the number of errors I found started dropping sharply after I figured that out.

In addition to the W3C validator, I used this excellent HTML resource from Ian Graham; which helped me understand what tags could be used where, and what tags were deprecated, or out-of-date. I used HTML Validator Lite to help me interpret the more obscure messages I got from the W3C validator. I didn't know which standard HTMLValidator Lite was using, so I doublechecked the changes it suggested on another test page before implementing them in the final corrected template. Many people recommend using HTML Tidy; my page was so far from valid when I started that Tidy had trouble processing it.

Other good things to be aware of (or "let my mistakes save you time"): Many of the errors I encountered were as a result of the improper handling of special characters in Javascript (like the "Blogroll Me!" link) or HTML (like a link to an item on Amazon.com) in my templates. I used the Hiveware URLCleaner and the CleanURL bookmarklet to give me the ASCII equivalents to characters like the dreaded ampersand. I made sure that each and every page had a DOCTYPE at the top; it's the validator's way of recognizing what kind of text you're about to feed it. I was under the mistaken impression that tables don't validate (this comes from hanging out with people who use and love cascading stylesheets); table tags must appear in the proper order (be properly nested) to ensure that designs with tables validate. Finally, if you do want to skin your website and you want it to be valid, you can; each skin you implement needs to be checked against the output of the validator.

Sound complicated? It's not nearly as complex as trying to ask for help when you're not sure what the problem is ("My site doesn't look like I thought it would in Browser X. Why?") Being able to say "My site validates, and I'm still having problem X" puts you a lot closer to a solution because more people will have an idea of what you're talking about. Don't be intimidated – give it a try. If I can do it without pulling my hair out, anyone can.

Guest authored by:
Donna – deliriouscool.org

12 Responses to "Site validation"

1 | Will

May 12th, 2003 at 4:11 pm

Avatar

Speaking of Validation, XHTML, and the dreaded ampersand, I had trouble getting my blog to validate for the longest time because the blog software I use utilizes PHP sessions. By default, PHP uses "&" instead of "& amp;" (without the space), which can cause hundreds of errors, depending on the number of links on your page. The easiest way I've found to fix this:

ini_set('arg_separator.output', '& amp;');

(Again, without the space)

2 | Karl Dubost

May 12th, 2003 at 9:14 pm

Avatar

Hi, good entry.

A new article is coming soon to help to validate their Website produced by the QA Team at W3C.

We have also released LogValidator written by Olivier Théreaux. ( http://www.w3.org/People/olivier/ )

You should dig at

http://www.w3.org/QA/Library

http://www.w3.org/QA/Tools

3 | Jennifer

May 12th, 2003 at 10:23 pm

Avatar

These are excellent tips, and I am currently working my way through my entire site. Thanks!

4 | Michelle

May 13th, 2003 at 10:34 am

Avatar

This is a fantastic article. It was extremetly helpful and inspiring. Thanks for posting your experience.

5 | Karl Dubost

May 22nd, 2003 at 8:40 pm

Avatar

And now you can add the Web Standards Switch article
http://www.w3.org/QA/2003/03/web-kit

6 | Live in the Delirious Cool

May 12th, 2003 at 2:25 pm

Avatar

Getting validated.
I made my blog more high-maintenance, but I also learned about coding so that people not looking at my computer screen could read my site.

7 | [ S K A I H I G H ]

May 12th, 2003 at 5:26 pm

Avatar

Script validation
I just finished a webpage the other day. I encountered som problems in different browsers and validated it. Not, suprisingly

8 | SuperDeluxo4

May 14th, 2003 at 12:12 am

Avatar

My Weblog is a Mitsubishi 3000 GT
I just now realized the craziest paralellity (new word!). We webloggers are like old hippies with their custom remodelled VW bus, or little rich white kids with their souped up Honda Civics. I just don't have the money to do that stuff so i spend my ti…

9 | Rodent Regatta

May 26th, 2003 at 10:07 am

Avatar

VALIDATION
Last year when I began this weblog there was a lot of discussion of "validation." At the time I didn't…

10 | SuperDeluxo4.2

October 10th, 2003 at 6:21 pm

Avatar

My Weblog is a Mitsubishi 3000 GT
Here's another repost. Reposting this one cause T.H.E.M. had a link to it and fixing a couple of other trackbacks. Not quite so poignant now since my stylesheets are all beat….

11 | Rizwan Kassim's Public Log

November 5th, 2003 at 7:05 pm

Avatar

Look Mom!
See what I've done? The side bars (just left for now) are collapsable, and not in the stupid way that the blogrolling is collapsable… It actually doesn't transmit the data if it doesn't need to, meaning an even quicker download…

12 | [supafine] geek blog

December 22nd, 2003 at 9:27 pm

Avatar

Yes, Virginia, There Is a Doc Type.
OK. Still slogging through the validation process. I realize I said some harsh words the other day about standards-compliance; I was a tad frustrated. Did a little more research today, and found a few articles: How-to's: Site Validation, from scriptygo…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements