السبت، 26 نوفمبر 2011

Why We Need DOCTYPE in The header of HTML Page

“ Before starting any HTML web page, you first must decide which DOCTYPE will be used. A DOCTYPE is a piece of code that is declared at the top of a document that instructs browsers or other software to use a specific language to interpret the rest of the included code. If you haven’t heard of DOCTYPEs, you may be thinking that all browsers already understand HTML, so why the need to declare a DOCTYPE at the top? Although you can create HTML for SharePoint or anything else that has no DOCTYPE declared, this method could cause the browser to render the page in unexpected ways. In fact, without any other intervention, an HTML page without a DOCTYPE is rendered by Internet Explorer in what’s known as Quirks mode. Quirks mode is similar to how IE 5.5 rendered pages, which can’t be a good thing; it was released ten years ago after all!
Several DOCTYPEs are available that will render your code in predictable ways. The following is a list of the most popular DOCTYPES in use today:
HTML 4.01 Strict  è   Allows all HTML elements but does not allow deprecated elements such as the tag.
HTML 4.01 Transitional è   Allows all HTML elements including deprecated elements.
XHTML 1.0 Strict è   Similar to HTML 4.01 Strict, but all tags must be well-formed XML.
Deprecated elements are allowed but must also be well-formed XML
XHTML 1.0 Transitional è   Similar to HTML 4.01 Transitional, but all tags must be well-formed XML. Deprecated elements are allowed but must also be well-formed XML

Source: Wrox.Professional.SharePoint.2010.Branding.and.User.Interface.Design.Nov.2010
To test your sites go to W3 org



0 التعليقات: