19 September 2007

HTML DOCTYPE... whats that ???

Ever wondered what is this doc type doing at the top of every HTML screen when you start building htm's in dreamweaver...... NOPE, frankly speaking I just blindly followed what dream weaver published, but was forced to learn more on the logic behind that because all HARSHLY UI recruiters started asking the defination of DOC type and why is it been used...

Why specify a doctype? Because it defines which version of (X)HTML your document is actually using, and this is a critical piece of information needed by browsers or other tools processing the document.

For example, specifying the doctype of your document allows you to use tools such as the Markup Validator to check the syntax of your (X)HTML (and hence discovers errors that may affect the way your page is rendered by various browsers). Such tools won't be able to work if they do not know what kind of document you are using.

But the most important thing is that with most families of browsers, a doctype declaration will make a lot of guessing unnecessary, and will thus trigger a "standard" parsing mode, where the understanding (and, as a result, the display) of the document is not only faster, it is also consistent and free of any bad surprise that documents without doctype will create.



So start with an basic defination, ul, liThe !DOCTYPE declaration is the very first thing in your HTML document, before the html tag. This tag tells the browser which HTML or XHTML specification the document uses.
  • According to HTML standards, each HTML document requires a document type declaration. The "DOC TYPE" begins the HTML document and tells a validator which version of HTML to use in checking the document's syntax


  • HTML 4 Strict


    The document type declaration for HTML 4.01 Strict is

    "http://www.w3.org/TR/html4/strict.dtd">

    HTML 4 Strict is a trimmed down version of HTML 4 that emphasizes structure over presentation. Some elements and attributes (including most presentational attributes), frames, and link targets are not allowed in HTML 4 Strict. By writing to HTML 4 Strict, authors can achieve accessible, structurally rich documents that easily adapt to style sheets and different browsing situations. However, HTML 4 Strict documents may look bland on very old browsers that lack support for style sheets..... so think twice before electing to this

    NOT RECOMMENDED.... until client cries a lot demands for the same


    HTML 4 Transitional

    The document type declaration for HTML 4.01 Transitional is

    "http://www.w3.org/TR/html4/loose.dtd">


    HTML 4 Transitional includes all elements and attributes of HTML 4 Strict but adds presentational attributes, elements, and link targets.

    RECOMMENDED highly.....


    HTML 4 Frameset

    "http://www.w3.org/TR/html4/frameset.dtd">

    HTML 4 Frameset is a variant of HTML 4 Transitional for documents that use frames. The FRAMESET element replaces the BODY in a Frame set document.

    Not sure because people are nowadays going away from FRAMES.... use it when there is a FRAME