Javatpoint Logo
Javatpoint Logo

HTML <!DOCTYPE> tag

On the HTML document you have often seen that there is a <!DOCTYPE html> declaration before the <html> tag. HTML <!DOCTYPE> tag is used to inform the browser about the version of HTML used in the document. It is called as the document type declaration (DTD).

Technically <!DOCTYPE > is not a tag/element, it just an instruction to the browser about the document type. It is a null element which does not contain the closing tag, and must not include any content within it.

Actually, there are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc.

The <!DOCTYPE> declaration refers Document Type Declaration (DTD) in HTML 4.01; because HTML 4.01 was based on SGML. But HTML 5 is not SGML based language.

DTD defines the rules for the markup languages so that the browsers recognize the content correctly.

The doctype declaration differs between HTML versions. The HTML 5 doctype declaration is given below.

Syntax

<!DOCTYPE html>

Following are some specifications about the HTML <!DOCTYPE>

Display None
Start tag/End tag Start tag only
Usage Structural

Let's see an example of HTML document with doctype declaration.

Test it Now

Note: It is always a good practice to add a declaration to your HTML documents to enable web browser to recognize that what type of document to expect.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<!DOCTYPE>YesYesYesYesYes

Note: DOCTYPE declaration is not case sensitive.

Next TopicHTML anchor Tag




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA