This is usually a mental list I go through when polishing up a web page. While it may seem second nature to some web experts, I thought it might be useful to those amatuers like me who constantly struggle with passing validation. I mainly use XHTML 1.0 Strict, but these should be good rules for all doctypes.
1. Declare a doctype in your header.
If your planning on following web standards the first thing to do is decide what type of standard you wish to follow, and let the browser know. See this article on different doctypes. This is the one I use on most of my work:
< !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “DTD/xhtml1-strict.dtd” >
2. Remember to close all tags.
Even those pesky self-closing tags. The one’s I always seem to fail with are: < img >, < hr >, and < br >. It’s easy to do, just make sure to inlclude a backslash at the end of a single tag like so:
< img src=“img.gif” / > < br / > < hr / >
3. Use alts on all images.
This is an easy habit to get into and it will save you a lot of time when validating if you can rememebr to do it as you code. An example:
< img src=“newlogo.gif” alt=“Christopher Scott- Ramblings of an amatuer web designer” / >
4. Use HTML symbools.
A very basic but frustrating rule to get used to. If you dont, the validation service can spit out about 5 different errors from one instance of a misused symbol. A great HTML symbol reference can be found here.
Also, keep in mind that this applies to any URLs in your HMTL as well. A lot of people are addign submit links to Digg, Technorati and others on their blogs, and those urls the user clicks on tend to include ampersands. Replace the ampersands with the HTML code: & . This is a before and after for my Digg link:
Before: < a href=“http://www.digg.com/submit?phase=2 & url= < txp:permlink / > “ > digg < /a >
After: < a href=“http://www.digg.com/submit?phase=2 & amp; url= < txp:permlink / > “ > digg < /a >
5. Don’t enclose a block element with an inline element.
This means elements like < span > < b > < strong> cannot contain a < div > < p > < ul > or < form >. This is usually the last thing I have to adjust/alter when finishing validation.
No comments yet
Metadata
Posted
Friday, October 27, 2006
Category
HTML & CSS
Social Bookmarking
del.icio.us,
Newsvine,
StumbleUpon,
digg
