HTML5 Doctype

The <! DOCTYPE HTML> Declaration

The <! DOCTYPE HTML> declaration is an important thing in HTML document before declaring <html> tag. The DOCTYPE is an instruction that associates particular SGML or XML document with document type definition.


In HTML 4, <! DOCTYPE HTML> refers to DTD because it is based on SGML. The DTD specifies the rules for the markup language. HTML 4 DOCTYPE describe the root element and provides two ways for finding the DTD namely- a URL and code for finding a local copy. HTML 4 comes in three different flavors each with different DOCTYPE.

HTML 4.01 Strict

The Strict DTD does not allow presentation elements like font, link targets. Instead we can use Cascading Style Sheets for that. Framesets are not allowed in this DTD. It can look like as follows :


HTML 4.01 Transitional

This DTD allows presentation and deprecated elements like font, link targets and all HTML elements and attributes. It does not allow framesets. It can look like as follows :

<!DOCTYPE HTML PUBLIC  “-//W3C//DTD HTML 4.01 Transitional//EN” “”>

HTML 4.01 Frameset

It allows the use of frameset contents. It is equal to HTML 4.01 Transitional which uses frames for documents. . It can be look like as follows :

<!DOCTYPE HTML PUBLIC  “-//W3C//DTD HTML 4.01 Frameset//EN” “”>


HTML 5 <! DOCTYPE HTML > is used to refer to Document Type Declaration (DTD) and written before the <html> start tag. It specifies which language and which version of the document we are using. In HTML5 we can specify DOCTYPE as follows :


HTML 5 Doctype Example

Following a simple example specifying the use of <! DOCTYPE HTML > :

<! DOCTYPE html>
<meta charset="ISO-8859-1">
<title>Simple Example</title>
	Welcome to JavaBeat

Note that the <! DOCTYPE HTML> declaration is case-insensitive. HTML5 recommends that tag must be included at the top of all HTML documents.


Next Tutorial :: HTML5 Events

Leave a Reply

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

Pin It on Pinterest

Share This

Share this post with your friends!