Validating Your WebPage to HTML 4.01
Validating HTML to two of three 4.01 standards (Transitional or Frameset) is one of the easiest things in the world. It's one of the only set of DOCTYPEs that allow you to get away with leaving in deprecated (<b>, <u>, etc — coding that is no longer considered correct) in. I'm not recommending this obviously — I prefer neat, new coding. However, if you're relatively new to web design but want to work on validation straight away — this is what to aim for.
Validating HTML to the Strict DOCTYPE on the other hand, is a little harder. Not as complex as the switch to XHTML — but we'll get to that later. You're not allowed to use deprecated coding with this document type.
So, what coding is deprecated you may ask? I've compiled a handy-dandy list of codes deprecated in HTML 4.01, just for you:
<applet><basefont><center><dir><font><isindex><menu><s><strike><u><xmp>
Most of these you won't recognise, so that's not a problem (I mean, what's <isindex>?), however — a lot of people still use <font>. There are two ways to get 'round this. The first way is to leave your text unedited, and the font will then be defined by the browser. However — this means you could end up with undesireable effects. The best way to get around this is to use CSS to define the font/colour/style instead. As HTML 4.01 support inline styles, we can change the font by adding this to the top of a document, between <head> and </head>:
<style type="text/css">
body {
color: #000000;
font-family: Verdana, Sans-Serif;
font-size: 11px;
}
</style>
And this means: color: #000000; changes the colour of your text, font-family: Verdana, Sans-Serif; changes the font to Verdana (if Verdana can not be found, the nearest Sans-Serif font is used) and font-size: 11px; changes the size of the text to 11px (or whatever size you insert). There is one HUGE advantage to using CSS to declare your font: once it's been assigned in the body { } of the CSS it will effect that entire HTML document (except for elements where font is not inherited) unless you specify otherwise (again, with CSS). This means you don't have to insert <font> 300 times in one page ever again.
Anyway — so what is actually required for valid HTML? Not much really.
- Use the proper document structure (html, head, title, /title, /head, body, /body, /html)
- You must remember to close your tags — things like
<a href="">needs to be ended with</a>and so on. - ..and you must include the correct DOCTYPE at the very top of your pages. I recommend:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
unless you're using frames; in which case you need:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
That's it. Validating your HTML should be that easy. All you need to do now is run it through the validator. If you get stuck on any errors, feel free to contact me.
Tags:
,
Last Updated On: 05th February 06 by Jem
Bookmark At: StumbleUpon, Digg

Handy Stuff
Downloads
Top Links
Resources