Tuesday, 4 March 2014

What is DOCTYPE Declaration(DTD) and how many DOCTYPE In html ?

the DTD extend for document type declaration,
The <DOCTYPE> declaration helps the browser to display a web page correctly.
there are many different documents on the web(World Wide Web), and a browser can only display on html page 100% correctly its also knows the html type and version used.

the DOCTYPE declaration defines the document type and version.

the DOCTYPE tells the browser which type of HTML is used a webpage and also what version of use document.
DOCTYPE is utilized by the web browser to identify the version of the markup language in which the page is written.


The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.
The <!DOCTYPE> declaration is not an HTML tag. it is an instruction to the web browser about what version of HTML the page is written in.

In HTML 4, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD. so its DOCTYPE is very simple.

=== You should not use  <!DOCTYPE> end tag.

==  The <!DOCTYPE> declaration is NOT case sensitive.


Types of DOCTYPE Declarations(DTD):-

(1) HTML 5===

    How to use====<!DOCTYPE html>

(2) HTML 4.01 Transitional===

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


(3) HTML 4.01 Strict==

        How to use===<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


(4) HTML 4.01 Frameset==

        How to use===<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">


(5) XHTML 1.0 Strict===

         How to use===<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


(6) XHTML 1.0 Transitional==

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


(7) XHTML 1.0 Frameset==

       How to use===<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">


(7) XHTML 1.1==


    How to use===<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

(8) XHTML mobile 1.0==

      How to use===<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">