-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
15 lines (11 loc) · 958 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
title: Doctype
slug: Glossary/Doctype
page-type: glossary-definition
---
{{GlossarySidebar}}
In {{Glossary("HTML")}}, the **doctype** is the required "`<!DOCTYPE html>`" preamble found at the top of all documents. Its sole purpose is to prevent a {{Glossary("browser")}} from switching into so-called ["quirks mode"](/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode) when rendering a document; that is, the "`<!DOCTYPE html>`" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.
## See also
- [Definition of the DOCTYPE in the HTML specification](https://html.spec.whatwg.org/multipage/syntax.html#the-doctype)
- [Quirks Mode and Standards Mode](/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode)
- [Document.doctype](/en-US/docs/Web/API/Document/doctype), a JavaScript method that returns the doctype