Search code examples
htmlvalidationdreamweaver

Dreamweaver html validation issue: "Tag must be paired"


I'm wondering if this is a quirk in Dreamweaver: The first tag in my html5 document is:

<!doctype html>

...and the last tag is:

</html>

When validating the document (W3C) from within Dreamweaver, I get this error:

Tag must be paired, no start tag: [ </html> ]

Could it be that Dreamweaver doesn't recognize the first tag with !doctype?


Solution

  • <!doctype html> is not an opening-tag. It's an SGML doctytpe declaration.

    The <html> opening tag goes after it, like so:

    <!doctype html>
    <html>
        <head>
        </head>
        <body>
        </body>
    </html>
    
    

    Backstory: SGML doctype declarations are usually far more complicated, and when HTML was ostensibly an application of SGML (e.g. in HTML4.01) then HTML documents needed full-form SGML DTDs like this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    

    ...however, ever since HTML5 was declared as "a living standard" without version numbers, and no-longer either SGML nor XML (rip XHTML) there was no need for a HTML5 DTD anymore, but for compatibility purposes the W3C and WHATWG said that <!doctype html> (without the older SGML PUBLIC/SYSTEM parts, and without a URI to the actual DTD) should be used.

    See here for details: Where is the HTML5 Document Type Definition?