Summary -

In this topic, we described about the <!DOCTYPE> tag along with detailed example.

The <!DOCTYPE> declaration supports the browser to display a web page properly. This tag is used to understand to understand the version of the HTML is being used. Current version is HTML5 and the declaration like below -

Syntax -

<!DOCTYPE html>

The doctype declaration is not case sensitive. The HTML version and corresponding declaration below -

Syntax -

<!DOCTYPE html>

HTML 4.01

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd"> 

XHTML 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Example -

<!DOCTYPE html>
<html>
	<head>
		<title> DOCTYPE Example.. </title>
	</head>
	<body>
		<!--  Below is the paragraph -->
		<p> Actual Paragraph. </p>
	</body>
</html>