
What is the use of DOCTYPE in HTML

DOCTYPE in HTML should be the first thing but why? Here is the answer to your question.
Doctype in HTML
In HTML <!DOCTYPE>
is a way to inform the browser about the HTML version that you will use in your HTML document. <!DOCTYPE>
should be the first thing in your HTML document so the browser knows what version of HTML the page is written in so that it can render your web page correctly.
In HTML 5 you can use <!DOCTYPE html>
but in HTML 4.01 it was <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Thanks for visiting.