Wednesday 26 June 2013

Role of in HTML

In HTML document from very first line we can notice one tag i.e <!DOCTYPE…<
This is not a HTML tag. This doctype refers to a Document Type Declaration(DTD).Most of the time we don't bother for such tag. In HTML programming we use different versions of HTML like HTML 4.01 StrictHTML 4.01 Transitional, XHTML 1.0 Strict etc. All these are defined in a machine-readable language taking the legal structure, elements and attributes. This is nothing but the job of DTD to categorise all version of HTML according to version definitions specified on W3c standard. As Web Accessibility has a key role in web development so this doctype inclusion is nothing but an addition. <!DOCTYPES are also essential for rendering and functioning of web documents in compliant browsers..
      There are few examples given below regarding the tags and it's properties. 
Examples:
XHTML 1.0:   

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

This DTD contains all HTML elements and attributes. Framesets are not allowed. The markup must also be written as well-formed XML.

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

This DTD is used when a webpage follows basic XHTML rules and uses some HTML presentational tags for user convenience but doesn't support CSS.

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

This DTD is same as Transitional DTD  except the use of <frameset> tag over <body>

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

This DTD excludes the presentation attributes and elements that W3C expects to phase out as support for style sheets matures.

2.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Transitional DTD allows some older elements and attributes that have been deprecated.3.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">



This declares the document to be HTML 4.01 Frameset. HTML 4 Frameset is a variant of HTML 4 Transitional for documents that use frames
          
 In order to get list of DTDs you can follow http://www.w3.org/QA/2002/04/valid-dtd-list.html.


Thanks,
Rajasekhar.

No comments:

Post a Comment