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.
HTML 4.01 DOCTYPE
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 :
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
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” “http://www.w3.org/TR/html4/loose.dtd”>
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” “http://www.w3.org/TR/html4/frameset.dtd”>
HTML 5 <! DOCTYPE HTML>
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 :
<! DOCTYPE HTML>
HTML 5 Doctype Example
Following a simple example specifying the use of <! DOCTYPE HTML > :
<! DOCTYPE html>
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