<!DOCTYPE> tag in HTML

<!DOCTYPE> declaration is must because it is an instruction to the web browser about what version of the markup language the page is written in HTML document.

Important Description

  • Always add the <!DOCTYPE> declaration to your HTML documents.
  • The <!DOCTYPE> declaration refers to a DTD in HTML 4.01, because HTML 4.01 was based on SGML.
  • The DTD specifies the rules for the markup language so that the browsers render the content correctly.

Example HTML5 Documents

<doctype> Tag Browser Support

Element Chrome Edge Firefox Safari Opera
<doctype> Yes Yes Yes Yes Yes

Important Notes

  • The <!DOCTYPE> declaration is NOT Case Sensitive.
  • The <!DOCTYPE> must not contain any content, and does not need a closing tag.

Common DOCTYPE Declarations

HTML 4.01 Strict

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

HTML 4.01 Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

HTML 4.01 Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.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">

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

© 2023 GDATAMART.COM (All Rights Reserved)