By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

The HTML Doctypes

Reference on the HTML document types, and on the new HTML doctype.

Edited: 2011-10-28 17:05

The document type is used to trigger standards-compliance mode in browsers. While not required, its best to include it to avoid many common rendering errors.

Including the doctype is mainly done to make the browser render the page in standards-compliance mode, rather then backwards compatibility-mode.

The new HTML Doctype

HTML is currently maintained as a living standard, so further updates will not be numbered or change the doctype.

<!DOCTYPE html>

XHTML uses the same doctype, and its optional whether you want to include it. Thats because delivering pages with the application/xml mine-type, automatically triggers standards-compliance mode.

Legacy Doctypes

Note. Below is only included for legacy purposes. For new sites, its recommended that you use the new <!DOCTYPE html> doctype declaration.

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

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

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

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

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

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