Forum Moderators: open

Message Too Old, No Replies

DOCTYPE declaration

How to I establish HTML version?

         

Talyrond

1:52 pm on Jan 16, 2002 (gmt 0)

10+ Year Member




I am new to web development and am struggling to resolve a problem.

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

Marshall

2:35 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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.

chiyo

2:47 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We just loaded IE6 to make sure our pages were displaying OK in it. Alas, they were a jumble - a lot of our code is based on what I learned 5 years ago, with work-arounds when things didnt look good in IE5, NS4, NS6, and laterlly Opera.

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.

Marshall

3:25 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Eliminating the URI is a good idea. For some reason, NN6 has a problem with it. A nice thing about the w3c validator is that you can have the page checked without a doctype declaration and select the one you think is appropriate. After it validates, just insert the right declaration and charset code.

Talyrond

3:38 pm on Jan 16, 2002 (gmt 0)

10+ Year Member



Thanks every body for the responces. Novice question, what does URI mean?

hasbeen

3:58 pm on Jan 16, 2002 (gmt 0)

10+ Year Member



URI = Uniform Resource Identifier..most commonly known as a URL...

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...]

TallTroll

4:22 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, check out this stuff on the W3C site [w3.org]. Theres a neat little diagram I'm not going to attempt to copy over that explains it quite well, I think

msgraph

4:29 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ultra-Edit loaded with the HTML tidy plugin will validate and add the Doctype line at the top.

tedster

6:38 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> When Chiyo mentions "remov[ing] the URI.." I think the //W3C// part is what is meant. Not too sure on that, though.

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.

hasbeen

6:53 pm on Jan 16, 2002 (gmt 0)

10+ Year Member



Thanks for clearing that up, tedster...I've not seen one with the full URI.

chiyo

6:57 pm on Jan 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yep that's what i was referring too.. we used the complete DTD tedster refers to.

..and it seems that what got us into trouble with our imperfect coding..