The Doctype
•The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.
•Earlier versions of HTML used more complex DOCTYPE tags.
•If you’re using HTML Version 4.01, the syntax for the tag is:
•If you’re using XHTML, the syntax for the tag is:
•When creating an HTML5 document, the first line of the document should be this tag:
•
•When the browser sees this tag, it assumes you are using HTML5.
•In HTML 4.01, all declarations require a reference to a DTD, because HTML 4.01 was based on SGML.
•
•When the browser sees this tag, it assumes you are using HTML5.
•In HTML 4.01, all declarations require a reference to a DTD, because HTML 4.01 was based on SGML.
HTML5 is not based on SGML, and therefore does not require a reference to a DTD.
Tip: Always add the declaration to your HTML documents, so that the browser knows what type of document to expect.
Standard Mode vs Quirk Mode
Modern browsers can use two different modes to interpret the CSS of a web document: standards mode and quirks mode.
Standards mode causes the browser to render the css according to the specification, which is correct and the way you would want it.
Quirks mode on the other hand causes the browser to render the CSS according to old, nonspecification rules. This mode exists for backwards compatibilty because older browsers didn't render CSS according to the specfications.
These days standards mode is the one you want to use, because in most cases the oldest browser you will be supporting will be IE6, which doesn't needs quirks mode to work correctly(although it probably will require some IE6 specific CSS, but chances are you already know that!).
Interstingly, or annoyingly, IE versions 6 to 8 render a web document as IE5.5 would, when they render a quirks mode page. And you definitely don't want this because the resulting rendered page is unpredictable.
Standards mode causes the browser to render the css according to the specification, which is correct and the way you would want it.
Quirks mode on the other hand causes the browser to render the CSS according to old, nonspecification rules. This mode exists for backwards compatibilty because older browsers didn't render CSS according to the specfications.
These days standards mode is the one you want to use, because in most cases the oldest browser you will be supporting will be IE6, which doesn't needs quirks mode to work correctly(although it probably will require some IE6 specific CSS, but chances are you already know that!).
Interstingly, or annoyingly, IE versions 6 to 8 render a web document as IE5.5 would, when they render a quirks mode page. And you definitely don't want this because the resulting rendered page is unpredictable.
HTML5 Multimedia Developers guide
HTML5 Multimedia: Develop and Design
No comments:
Post a Comment