Page 63 - HTML5
P. 63
Chapter 11: Doctypes
Introduction
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.
Syntax
• <!DOCTYPE [version-specific string]>
Remarks
The <!DOCTYPE> declaration is not an HTML tag. It is used for specifying which version of HTML the
document is using. This is referred to as the document type declaration (DTD).
The <!DOCTYPE> declaration is NOT case sensitive. To check if the HTML of your Web pages is
valid, go to W3C's validation service.
• Some old versions of IE don't support some HTML tags unless a proper doctype is available.
• It's vital that a doctype is declared as to make sure the browser doesn't use quirks mode.
More info on MDN.
Examples
Adding the Doctype
The <!DOCTYPE> declaration should always be included at the top of the HTML document, before the
<html> tag.
5
See HTML 5 Doctype for details on the HTML 5 Doctype.
<!DOCTYPE html>
4.01
See HTML 4.01 Doctypes for details on how these types differ from each other.
Strict
https://riptutorial.com/ 47

