• Register
12,140 points
9 5 2

In this article we are going to discuss the use of doctype in HTML.we will also discuss the declaration of doctype in different types of HTML version.
 

About doctype


Doctype is a HTML statement that stands for document type declaration. We use this because it informs the browser about type and the version of html used for building the web document and this also helps the browser to handle and load properly.When the HTML syntax for this statement is a little simple, we must note each version of HTML has its own rules.
Now we will learn about declaration of doctype in different html versions.

 

 HTML5


The declaration doctype in HTML5 is simplest as compared to all versions.


Syntax


<!DOCTYPE html>

 

HTML 4.01

The declaration of doctype in HTML 4.01 is  longer, even more descriptive also as compared to HTML5. Because it contains all the HTML tags as well attributes. But it does not allow for using framesets.here’s the example.

syntax

​
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

​

XHTML 1.0 Strict
 

This html  document declaration also contains  all HTML tags and attributes, but no presentational element, although it must be written in strict XML

syntax

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">

 

XHTML 1.1 Strict

In this version the declaration is very similar to XHTML 1.0 strict but it lets you to add modules like provide ruby text support for asian languages 

syntax

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">



Hope this will help.