Forum Moderators: open
I need help with: DOCTYPE declaration
I have validated the code from my site using [searchengineworld.com...] the result was not good, the first error was: Missing DOCTYPE declaration at start of document. I have look hard on the net but no joy.
My question is: I use Dreamweaver 4, which does not output the DOCTYPE declaration line, of course its no problem adding the line but how do I establish what version of HTML my code is?
I hope once I have add the correct line some of the other errors will disappear.
Talyrond
Assuming you're using HTML, a safe declaration is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Also include:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
And for a better validator, use the one located at www.w3c.org. It gives you the option to select these two elements when they're not present. They also have a CSS validator.
We were using the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> with the URI declaration to W3C on all our pages. I think our problem was that we were using the URI declaration as well, but we didnt wait around long enough before re-uploading pages!
In any event removing the doctype made everthing view normally. And also adding <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> made everything OK.
We replaced all our pages we were not absolutely sure were HTML 4 compliant with that 3.2 declaration.
So I guess the advice from my experience is go for the lowest common denominator (3.2 Final) for safety unless you are absolutely sure your pages are compliant to the higher standards.
When Chiyo mentions "remov[ing] the URI.." I think the //W3C// part is what is meant. Not too sure on that, though.
More info on DOCTYPE can be found here:
[blooberry.com...]
A complete DTD will look like the following, including the URI to the w3.org dtd.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
That URI on the second line has been known to flake out certain browsers.