Document Type Declaration

Web browsers can display several types of documents, not just HTML, so when creating a web document the first thing you do is tell the browser what type of document is coming. You declare the type of document with a special line of HTML at the top of the document.

In technical terms, the document type is called the Document Type Declaration, or DTD for short.

In prior versions of HTML, developers needed to constantly copy and paste the document type into the document because it was both long and complicated. With the release of the latest version of HTML, called HTML5, the document type has been greatly simplified.

The first line of any HTML code is document type declaration. 

HTML5

<!DOCTYPE html>

HTML 4.01

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

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Subscribe for Free Updates

Please enable the javascript to submit this form