Doctypes in HTML

Learn HTML5
This entry is part 2 of 4 in the series Learn HTML5

Doctypes – short for ‘document type‘ – help browsers to understand the version of HTML the document is written in for better interpretability. Doctype declarations are not HTML tags and belong at the very top of a document. This topic explains the structure and declaration of various doctypes in HTML.

Adding the Doctype

The declaration should always be included at the top of the HTML document, before the <html> tag.

See HTML5 Doctype for details on the HTML 5 Doctype

HTML 5 Doctype

HTML5 is not based on SGML (Standard Generalized Markup Language), and therefore does not require a reference to a DTD (Document Type Definition).

HTML 5 Doctype declaration:

Case Insensitivity

Per the HTML 5 DOCTYPE Spec:

A DOCTYPE must consist of the following components, in this order:

1. A string that is an ASCII case-insensitive match for the string “<!DOCTYPE”.

therefore the following DOCTYPEs are also valid:

This SO article discusses the topic extensively: Uppercase or lowercase doctype?

Series NavigationPrevious: Getting started with HTMLNext: Headings tag in HTML


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.