HTML doctype declaration

<!doctype> in html

doctype in html

In the previous blog, we read about Comment Tag in HTML. Here in this blog, we will cover the Doctype Declaration in html.

The doctype declaration mandatory to be the very first thing in your HTML document, before the html tag.

The declaration is not an HTML tag; it tells to the web browser about what version of HTML the web page is using in the document.

In HTML 4.01, the declaration refers to a DTD (document type definition), because HTML 4.01 was based on SGML (Standard Generalized Markup Language). The DTD defines the rules for the markup language, so that the browsers render the correct content.

Tip: Always include the declaration to your HTML document, so that the browser easily identifies what type of version we are using.

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

<html>

<head>

<title>webpage title</title>

</head>

<body>

Content of web page will be here…

</body>

</html>

NOTE: In below figure, Doctype declaration is mentioned in the box.

doctype declaration in html

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *