What Is Doctype In HTML: The Document Type Declaration

Ashim khatua
2 min readJul 26, 2021

--

The HTML Doctype is the first line of code in every HTML document. The doctype provides information to the browser on which HTML versions are used to design the document. So don’t forget to declare the doctype.

The Doctype declaration stands for document type declaration. It places before the root element. If you forget to mention it, browsers will run your document in Quirks mode.

HTML5 Doctype

The doctype declaration in HTML 5 is very easy and simple. It does not require any DTD. And it is not cased sensitive.

Doctype Declaration in XHTML

The HTML doctype declaration in XHTML is is very lengthy. Its require a Document Type Defination (DTD)

Three possible types of Declaration in XHTML.

  1. Strict
  2. Transitional
  3. Frameset

Strict Type Declaration

Strict type declaration supports all tags and elements expected deprecated elements.

Frameset Type Declaration

The frameset type declaration supports all deprecated elements including frames.

Transitional Type Declaration

The transitional type declaration supports all deprecated elements but does not support frames.

--

--

Ashim khatua
0 Followers

Professionally Web Developer since 2015, And also a Blogger. I love to share my knowledge, which I learned in the past few years.