Forum Moderators: open

Message Too Old, No Replies

DTD and the HTML tag

Do you need both?

         

Joellyn

6:30 pm on Aug 15, 2002 (gmt 0)

10+ Year Member



I'm having a problem with validation - if you use a DTD, does that replace the <html> tag, or do you need the DTD then <html>?

For some reason I thought it replaced <html> and my page validates fine using W3C's validation service. However when I tried validating it using Dreamweaver MX, it said that I needed the <html> starting tag.

Which way is proper? TIA!

Joellyn

ergophobe

7:10 pm on Aug 15, 2002 (gmt 0)

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



You need both. DOCTYPE tells it which DTD to validate to and, for html or xhtml documents, the root element must be html. It's apples and oranges, both part of a balanced diet.

If I use the W3C validator with XHTML 1, I get

<head>
^Error: element "head" not allowed here; assuming missing "html" start-

As for leaving off the doctype - funny thing about the W3C validator - if I leave off the doctype, and try to use doctype override, it flags all kinds of errors with my doctype tags (which aren't there) and gives fatal errors. Apparently it doesn't even recognize it's own code as valid DTD.

pcguru333

7:12 pm on Aug 15, 2002 (gmt 0)

10+ Year Member



You need the HTML tag. The DTD tag doesn't replace it.

See W3C

[w3.org...]