About This HTML Issue
The doctype declaration tells browsers which version of HTML a page uses and, critically, determines whether the browser renders the page in standards mode or quirks mode. Standards mode follows current CSS and HTML specifications, while quirks mode emulates the buggy behavior of older browsers from the late 1990s and early 2000s. When the W3C validator reports “Quirky doctype,” it means your document’s doctype is one that is known to trigger quirks mode—and in the context of modern HTML, this is always undesirable.
Several legacy doctypes can trigger this warning, including:
-
<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN">(without a system identifier URL) -
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN"> - Malformed or incomplete doctype declarations
- Doctypes with unexpected casing or extra whitespace in certain positions
The HTML Living Standard (maintained by WHATWG) specifies that the doctype must be <!DOCTYPE html>. This short declaration is case-insensitive but is conventionally written in uppercase. It exists solely to trigger standards mode—it does not reference a DTD because HTML5 is not based on SGML.
Why This Matters
Inconsistent rendering: In quirks mode, browsers alter how they calculate the box model, handle table sizing, apply inline element dimensions, and more. A page that looks correct in one browser may break in another because each browser’s quirks mode emulates different legacy behaviors.
Accessibility and interoperability: Screen readers and other assistive technologies rely on predictable DOM behavior. Quirks mode can cause unexpected layout shifts and content reflow that degrade the experience for users of assistive technology.
Standards compliance: Modern HTML validators expect the HTML5 doctype. Using a legacy doctype signals that the document is not following current web standards, which can also affect SEO tools and automated audits.
How to Fix It
- Open your HTML file and locate the very first line.
-
Replace whatever doctype declaration is there with
<!DOCTYPE html>. - Ensure nothing appears before the doctype—no whitespace, no comments, no byte order marks (BOMs). Any content before the doctype can also trigger quirks mode in some browsers.
-
Verify that the rest of your document uses valid HTML5 syntax (e.g., the
<html>tag includes alangattribute, the<head>contains a<meta charset>declaration and a<title>element).
Examples
Incorrect: Legacy doctype triggering quirks mode
<!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>My Page</title>
</head>
<body>
<p>This page renders in quirks mode.</p>
</body>
</html>
This HTML 4.0 Transitional doctype without a system identifier URL is a known quirks-mode trigger.
Incorrect: Another common quirky doctype
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>My Page</title>
</head>
<body>
<p>This older doctype also triggers quirks mode.</p>
</body>
</html>
Correct: Standard HTML5 doctype
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Page</title>
</head>
<body>
<p>This page renders in standards mode.</p>
</body>
</html>
The simple <!DOCTYPE html> declaration ensures standards mode across all modern browsers. It is the only doctype you should use for new HTML documents, and it is also fully backward-compatible with older browsers—even Internet Explorer 6 renders in standards mode with this doctype.
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.