After marking the Homework 3 assignments (the basic HTML page), I've
had a <i>mea culpa</i> moment: just because I've spent the past 15
years writing invalid HTML, doesn't mean I should teach you to do so,
In particular, I think we should start including the DOCTYPE header
in our HTML pages. This tells the browser (and any other interested
parties) what version of HTML our page is adhering too. Most importantly,
this also means that when we submit our pages to the w3 validator:
we actually have a chance of having no errors (because the validator
requires a DOCTYPE declaration).
So, at the top of each HTML page, before the opening <html> tag,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
for HTML. If you want to try XHTML instead, use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
(If you don't know the difference between HTML and XHTML, just use
HTML). Also, if you want also to avoid warnings from the validator, then
within your <head></head> tag to report the character set. See:
for a list of doctypes, and:
for a brief explanation of them.
Once the DOCTYPE headers have been added, you should use the
w3 validator on your pages, and try to fix all errors it finds. This is
can be an interesting (i.e. frustrating) debugging experience, but it
is good experience. One tip is that an actual error in one part of
the page can spark off spurious errors in other parts, so try to fix
the first bug first, then retest the page and see if the others disappear.