doctype-first
Doctype must be declared before any non-comment content. Comments and whitespace are allowed before the DOCTYPE declaration.
Level: Error
Config value
Section titled “Config value”true: enable rulefalse: disable rule
The following patterns are not considered rule violations
Section titled “The following patterns are not considered rule violations”<!DOCTYPE html><html></html><!-- Comment before doctype --><!DOCTYPE html><html></html>The following patterns are considered rule violations
Section titled “The following patterns are considered rule violations”<html></html><div>Content before doctype</div><!DOCTYPE html><html></html>Why this rule is important
Section titled “Why this rule is important”The DOCTYPE declaration is required for HTML5 compliance and to ensure that the document is parsed correctly.