Syntax of the <!DOCTYPE html> Tag for HTML 5
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet ...?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>
Rules for coding the DOCTYPE declaration for HTML 5
- Code the DOCTYPE declaration just before the beginning <html> tag, below the xml declaration and any processing instructions such as an xml-stylesheet processing instruction.
- The DOCTYPE declaration starts with the characters
<!. This indicates that the element is a SGML declaration rather than an HTML tag. (Besides the DOCTYPE declaration, the only other HTML code that starts with the characters <! are HTML comments.)
- Code the name of the top element of the document. The DOCTYPE for HTML documents is
html. This is not a named attribute value, and therefore is not enclosed in quotes.
- Do not include a
PUBLIC DTD identifier or SYSTEM URL. There is no DTD in HTML 5.
- The
DOCTYPE declaration ends with the character >. (There is no ! or self-closing / before the > terminating delimiter.)
- The
DOCTYPE declaration does not have a corresponding end tag.