Syntax
<!doctype html>
<html lang="en">...</html>Examples
DOCTYPE and Standards Mode: working example
Save as an HTML file and open it in a browser. Expected result: The output displays CSS1Compat for this standards-mode document.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Working example</title>
</head>
<body>
<h1>Standards-mode document</h1>
<output id="mode"></output>
<script>
document.querySelector("#mode").textContent = document.compatMode;
</script>
</body>
</html>- Expected result: The output displays CSS1Compat for this standards-mode document.
- The short doctype avoids legacy quirks triggers.
- document.compatMode distinguishes BackCompat from CSS1Compat; CSS1Compat also includes limited-quirks mode in other documents.
Best practices
- Place the modern doctype at the start of each HTML document.
- Keep an explicit language and character encoding alongside a meaningful title.
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
Document.compatMode reports the mode; its support does not establish support for every standards-mode rendering behaviour.
DOCTYPE and no-quirks rendering
Desktop
- Chrome
- Unknown
- Firefox
- Unknown
- Safari
- Unknown
- Edge
- Unknown
- Opera
- Unknown
Mobile
- Safari on iOS
- Unknown
- Chrome for Android
- Unknown
- Firefox for Android
- Unknown
- Samsung Internet
- Unknown
No single verified compatibility record for this topic. Use the feature-specific articles; no browser support is inferred.
Document.compatMode
Desktop
- Chrome
- Supported
From 8 - Firefox
- Supported
From 19 - Safari
- Supported
From 5.1 - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
From 5 - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 19 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 8
- From 1 · Removed in 8 · Last supported version: 7 · Partial implementation · Only supported for HTMLDocument, not all Document objects.
Firefox
- From 19
- From 1 · Removed in 19 · Last supported version: 18 · Partial implementation · Only supported for HTMLDocument, not all Document objects.
Safari
- From 5.1
- From 3.1 · Removed in 5.1 · Last supported version: 5 · Partial implementation · Only supported for HTMLDocument, not all Document objects.
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- From 5
- From 2 · Removed in 5 · Last supported version: 4.2 · Partial implementation · Only supported for HTMLDocument, not all Document objects.
Chrome for Android
- From 18
Firefox for Android
- From 19
- From 4 · Removed in 19 · Last supported version: 18 · Partial implementation · Only supported for HTMLDocument, not all Document objects.
Samsung Internet
- From 1.0
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.