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" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
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:
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”
cool, since im only starting to learn html, this is way easier.
It actually has become the standard of HTML 5.
Comments are closed.