lint
for C. It compares
your HTML document to the defined syntax of HTML and reports any
discrepancies.
One of the important maxims of computer programming is: Be
conservative in what you produce; be liberal in what you accept.
Browsers follow the second half of this maxim by accepting Web pages and trying to display them even if they're not legal HTML. Usually this means that the browser will try to make educated guesses about what you probably meant. The problem is that different browsers (or even different versions of the same browser) will make different guesses about the same illegal construct; worse, if your HTML is really pathological, the browser could get hopelessly confused and produce a mangled mess, or even crash.
That's why you want to follow the first half of the maxim by making sure your pages are legal HTML. The best way to do that is by running your documents through one or more HTML validators.
FIXME
nsgmls
SGML parser. The Validator itself is a CGI script that fetches your
URL, passes it through nsgmls
, and post-processes the
resulting error list for easier reading.
DOCTYPE
declaration to your document; see the
section on DOCTYPE
for more information. If your
document does not have a DOCTYPE
declaration, The
Validator will assume an HTML 4.0 document type (and will tell
you it is doing so).
Don't panic. Did The Validator complain about your
DOCTYPE
declaration (or lack thereof)? Make sure your
document has a syntactically correct DOCTYPE
declaration, as described in the section
on DOCTYPE
, and make sure it correctly identifies
the type of HTML you're using. Then run it through The Validator
again; if you're lucky, you should get a lot fewer errors.
If this doesn't help, then you may be experiencing a cascade failure — one error that gets The Validator so confused that it can't make sense of the rest of your page. Try correcting the first few errors and running your page through The Validator again.