Total Page Views :- webs counters

What is Doctype

Doctype defines the type of web document we are using. Doctype includes the version of HTML and its DTD. Website will not be fully functional without doctype in Internet Explorer lower versions.

Doctype is always declared before HTML opening tag


Doctype in HTML5

HTML5 Based Doctype is smaller than HTML4 and XHTML based doctypes. No need to specify the DTD and html version.


Doctype in HTML5


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" >
	<title>HTML5 Doctype</title>
</head>
<body>
		HTML5 Webpage
</body>
</html>

Doctype in HTML 4(STRICT)

In HTML4, Strict type Doctype include all attributes and HTML Elements. It Doesn't Include Presentation elements like <b>, <i>, <s>, etc. Framesets are not allowed in STRICT Type Doctype


Strict Type DOCTYPE in HTML4


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
		<title>HTML4 Webpage</title>
	</head>
<body>
		HTML4 Strict Webpage
</body>
</html>


Doctype in HTML 4 (Transitional)

In HTML4, transitional type doctype includes all attributes and HTML Elements. They also Includes Presentation elements like <b>, <i>, <s>, etc. Framesets are also not allowed in Transitional Type Doctype


Transitional Type DOCTYPE in HTML4


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
		<title>HTML4 Webpage</title>
</head>
<body>
		HTML4 Transitional Webpage
</body>
</html>

Doctype in XHTML

Extensible HyperText Markup Language Doctype


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>XHTML Webpage</title>
</head>
<body>
		XHTML Transitional Webpage
</body>
</html>