Use The HTML5 Doctype

ID

html.doctype_html5

Severity

low

Remediation Complexity

low

Remediation Risk

low

Remediation Effort

low

Resource

Reliability

Language

Html

Tags

reliability

Description

Flags a doctype declaration that is not the standard HTML5 <!DOCTYPE html>.

Rationale

The legacy XHTML and HTML 4.01 doctypes carry public and system identifiers that pin the document to an obsolete DTD. Modern browsers ignore those identifiers but the verbose, transitional forms add noise and can trip older tooling, while only the short <!DOCTYPE html> form is guaranteed to select standards mode unambiguously.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "...">   <!-- FLAW — legacy doctype -->

<!DOCTYPE html>                                                  <!-- OK — HTML5 doctype -->

Remediation

Replace the legacy doctype with the HTML5 form <!DOCTYPE html>.

References