HTML 5 Programming and Web development/HTML 5 Doctype

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The HTML 5 Document Type Definition (Doctype) is used to identify the type of markup document. conventionally doctypes are written like this

<!doctype root-element PUBLIC [FPI] [URI]>

Where in this case the root-element would be HTML.FPI stands for formal public identifier. However in HTML 5 the Doctype is just written <!doctype html>

Example of doctype in HTML 5[edit | edit source]

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
    </body>
</html>

The doctype must always be at the top of the document.

Document without doctype[edit | edit source]

Documents without doctype would work in most browsers ,but would not be classified as a valid document.(see Validation).