DOCTYPE Dilemmas

2004 May 30
by Karen

DOCTYPE Dilemmas

Haven't got a clue what a DOCTYPE is or not sure is yours is right? Then you need to check out, Fix Your Site With the Right DOCTYPE! by Jeffrey Zeldman. This article discusses what a DOCTYPE is and why if your (X)HTML page has an incorrect or missing DOCTYPE your pages might not be rendering properly in the latest browsers.

DOCTYPE stands for Document Type Definition. A DOCTYPE is key to getting your web page to validate properly. This is because a DOCTYPE tells the validators and browsers what version of HTML or XHTML you are using. Without it the validators and web browsers can't tell what set of rules to compare your markup against. As a result, a missing DOCTYPE in many browsers (with the exception of Opera) means that the browser operates in “Quirks” mode, “where the browser assumes you’ve written old-fashioned, invalid markup and code per the depressing industry norms of the late 1990s.” (Zeldman 2004) This is not desirable at all because it makes your nice Web Standards compliant code render like junk.

So check out Zeldman's article, he provides a list of proper functional DOCTYPEs that you can use. Make sure you use these to check out the code written by your favorite web editor, because even some of these aren't correct.

Comments are closed for this entry.