الثلاثاء، 3 يناير 2012

HTML - DOCTYPE Declaration

DOCTYPE Declaration is the abbreviation for Document Type Declaration (DTD).The DOCTYPE Declaration (DTD or Document Type Declaration) does a couple of things:
1.When performing HTML validation testing on a web page it tells the HTML (HyperText Markup Language) validator which version of (X)HTML standard the web page coding is supposed to comply with. When you validate your web page the HTML validator checks the coding against the applicable standard then reports which portions of the coding do not pass HTML validation (are not compliant).
2.It tells the browser how to render the page in standards compliant mode.
If the web page coding does not include a DOCTYPE Declaration (DTD or Document Type Declaration) or it is done incorrectly:
1.You will not be able to use a HTML (HyperText Markup Language) Validator to check the page coding. HTML validation requires the DOCTYPE declaration.
2.The browser rending the web page will process the coding in Quirks Mode.
3.The stylesheet may not be implemented as planned.
Which DOCTYPE should you use?
If you are a beginner to HTML (HyperText Markup Language) then I would suggest you use the HTML 4.01 Transitional declaration. It is much more forgiving for the beginner when performing HTML validation. You would also use this declaration if you know that your audience will not have a browser that supports CSS (Cascading Style Sheets).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> This DOCTYPE declaration still allows elements and presentation attributes that should be in the stylesheet.
If you want to learn to code in preparation for the future but still not ready for XHTML then you would use the Strict declaration.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> With this declaration all presentation attributes are moved to the stylesheet.
A complete list of DOCTYPE Declarations (DTDs) is available at List of valid DTDs you can use in your document.