DOCTYPE and Standards Mode

The <!doctype html> declaration tells the browser to use modern standards mode. It is not an HTML element. Omitting the declaration can cause browsers to enter quirks mode, where historical rendering behavior may affect layout and CSS.

Always Include DOCTYPE

Start modern HTML documents with <!doctype html> to avoid accidental quirks-mode rendering.

Key Takeaways
  • DOCTYPE is a declaration, not an HTML element.
  • Modern documents should use <!doctype html>.
Knowledge Check

What is the purpose of <!doctype html>?