Skip to main content

HTML Guide

Quirky doctype. Expected “<!DOCTYPE html>”.

The <!DOCTYPE html public "-//W3C//DTD HTML 4.0 Transitional//EN"> doctype triggers quirks mode in modern browsers and is not compliant with HTML5 standards.

The HTML5 specification requires the use of a simple doctype declaration, which ensures standards mode rendering. The correct doctype is <!DOCTYPE html>, which must appear at the very top of every HTML5 document. Legacy doctypes like HTML 4.0 Transitional are obsolete for modern web development and can cause inconsistent browser behavior.

Example of correct usage:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Valid HTML5 Doctype Example</title>
  </head>
  <body>
    <p>Your content here.</p>
  </body>
</html>

Replace any legacy or malformed doctype with the above declaration to conform to current HTML standards.

Learn more:

Related W3C validator issues