Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: incrediBILL
Without it, each browser may interpret some tags differently, leading to a rendering that is more varied between browsers than you'd want.
Without it, many browsers will drop into "quirks" mode -- meaning they'll assume you've coded to match their bugs. If you've actually written clean, validated code chances are this means they've mis-interpreted some of your code.
With it, you aren't guaranteed that browsers won't exhibit bugs -- after all, they all have them, but you are better assured that the page will render correctly across a wide range of browsers.
Some more information at:
You certainly CAN have pages with no DTD, the web is full of them. But for a validator to do anything more than a surface check for unclosed tags and bad nesting, it is going to need the DTD.
Speaking personally, validating to a full DTD has taught me a lot - in areas where I thought I already had it nailed.
I also thought this might be a good place to give the link to the W3C's list of valid DTDs [w3.org]. Finally all gathered together in one place. And that place is the source of the HTML standards, so it's the right place to check.
However, long term, you should aim to add these elements to your code on every page.
You might also want to consider what else you put in the header. For most people, code on each page begins something like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title> Your Title Here </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="EN-GB">
<meta name="Keywords" content=" your, keyword, list, here ">
<meta name="Description" content=" Your Description Here. ">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
Code within the page:
I use: <a href="somepage.html" title="some text here"></a> for links.
I use <img src="somefile.png" alt="some text"> for images.
Headings are done with <hx></hx> tags, properly used from <h1></h1> downwards.
[edited by: g1smd at 2:11 am (utc) on June 18, 2003]