What is the DOCTYPE Declaration in HTML?

Harshad Rathod
1 min readJun 26, 2022

The doctype is declared in the first line of HTML or XHTML. It tells the browser what version of HTML code is being utilized.

Doctype syntax for html5 and beyond

Doctype syntax for html 4.01

Web standards were not agreed upon within the first year of HTML. So when someone wrote html code, they had to build it with a certain browser in mind, which implies the code might not work the same way in different browsers.

As a result, the World Wide Web Consortium (W3C) developed some standards that everyone had to follow. The code can be rendered across web browsers if these standards are followed.

That is why web developers were required to include doctype at the beginning of their code.

source : here

That concludes this article.

If you found this article useful follow me on twitter @Hxrshxd for more.

--

--

Harshad Rathod

I write about anime, programming,books, etc. or whatever I like about.