HTML Doctype Tag

HTML Doctype Tag

The Doctype declaration is not an HTML Tag, It is used to tell the Browser about the version of HTML written on the web page. The Doctype tag is the first tag in HTML document you should write just before Html starting tag.

Doctype Tag Example

<!DOCTYPE html>
<!--I am a DOCTYPE Tag with other HTML tags.-->

Case Sensitivity of Doctype Tag

The Doctype declaration is not case sensitive but It is always preferred to write it in upper case letters as shown above.

Doctype Declaration in HTML5

There are many versions of HTML but current version is HTML5. So now it's necessary to put HTML5 Doctype declaration whenever you write html code.

There is only one type of Doctype declaration in HTML5. This declaration will tell the browser that document is written in HTML5

Syntax of HTML5 Doctype declaration is as follow.

<!DOCTYPE html>

Doctype Declaration in previous versions of HTML

In earlier version of HTML, HTML 4.01, Doctype declaration was used for DTD. There are three different Doctype declarations in HTML 4.01.

DTD is a Document Type Definition. DTD defines the structure, elements, attributes and the rules for markup language in an XML document. HTML 4.01 was based on SGML.

All the rules and standards have only one purpose and that purpose is to display the content properly on the web page.

Note: HTML5 does not require a reference to DTD because it is not based on Standard Generalized Markup Language.

Types of DOCTYPE Declarations

Following are some types of Doctype declaration, HTML5 is the simplest one and you should only care about HTML5 one.

HTML 5 Doctype

<!DOCTYPE html>

HTML 4.01 Transitional Doctype

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

HTML 4.01 Frameset Doctype

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

XHTML 1.0 Strict Doctype

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

XHTML 1.0 Transitional Doctype

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

XHTML 1.0 Frameset Doctype

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

XHTML 1.1 Doctype

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

HTML Doctype Tag Video

Watch our video on doctype tag and subscribe our Youtube Channel.

HTML Comment Tag HTML Doctype Tag HTML anchor Tag HTML abbr Tag HTML acronym Tag HTML address Tag HTML applet Tag HTML area Tag HTML article Tag HTML aside Tag HTML audio Tag HTML b Tag HTML base Tag HTML basefont Tag HTML bdi Tag HTML bdo Tag HTML big Tag HTML blockquote Tag HTML body Tag HTML br Tag HTML Button Tag HTML Canvas Tag HTML Caption Tag HTML Center Tag HTML Cite Tag HTML Code Tag HTML Col Tag HTML colgroup Tag HTML data Tag HTML datalist Tag HTML dd Tag HTML del Tag HTML details Tag HTML dfn Tag HTML dialog Tag HTML dir Tag HTML div Tag HTML dl Tag HTML dt Tag HTML em Tag HTML embed Tag HTML fieldset Tag HTML figcaption Tag HTML figure Tag HTML font Tag HTML footer Tag HTML form Tag HTML frame Tag HTML frameset Tag HTML Heading Tags HTML head Tag HTML header Tag HTML hr Tag HTML html Tag HTML i Tag HTML iframe Tag