HTML DocType Text: World’s Tiniest and Shortest HTML DocType Declaration

Dustin Diaz made an interesting discovery to trigger “standards mode” with just a tiny little declaration instead of the regular lengthy one we see everywhere.

As opposed to “standard mode“, there’s this “quirks mode” in IE that accommodates legacy HTML code of no standards at all — rendering them in many different ways compared with standardized HTML who has a harassing top declaration of document type. For example, common HTML document declarations include:

HTML 4.01 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">

For a more detailed collection of HTML doctypes, read here.

However, except for the sake of validation, a declaration usually counts for nothing. The only purpose of leaving one at the top of every web page you create is for the client browser to make the HTML out in standard way rather than in quirks way. Dustin has found a rather convenient short cut for this:

<!doctype html>

It’s much more memorable and correctly triggers the standard mode. We call it the skinny html doctype.

2 thoughts on “HTML DocType Text: World’s Tiniest and Shortest HTML DocType Declaration”

Comments are closed.

Scroll to Top