<!DOCTYPE>
The document type declaration: tells the browser the page is written in modern HTML.
Syntax
<!DOCTYPE html>Examples
The first line of every page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home</title>
</head>
<body>
<p>The page starts with the doctype.</p>
</body>
</html>Notes
It is not a tag but an instruction for the browser, so it has no closing part. Case does not matter: <!doctype html> works too. Without it the browser switches to "quirks mode" for old pages, and layout can behave unexpectedly — for example, box sizes are calculated differently.
See also
Related recipes
In the tutorial
- Document structure — The skeleton of an HTML page — doctype, html, head and body, the encoding, the tab title, viewport and your first index.html file.