Skip to content

doctype-first

Doctype must be declared before any non-comment content. Comments and whitespace are allowed before the DOCTYPE declaration.

Level: Error

  1. true: enable rule
  2. false: 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>