HTML 4.01 Strict DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
HTML 4.01 Frameset DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" " http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd">
XHTML 1.0 Strict DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Frameset DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
XHTML 1.1 DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Here’s a basic page with the HTML5 DTD and the required
<!DOCTYPE html> <html> <head> <title>CSS Cookbook</title> </head> <body> <h1>My Basic Web Page</h1> <p>Epsum factorial non deposit quid pro quo hic escorol.</p> </body> </html>
A DOCTYPE, short for document type definition, defines an HTML or XHTML document’s building blocks and tells the browsers and validators which version of HTML or XHTML your document uses.
The DOCTYPE declaration must appear at the beginning of every web
page document, before the
html element, to ensure
that your markup and CSS are standards compliant and that browsers
handle the pages based on the appropriate DTDs.
Quirks mode occurs when a browser treats a web page as “buggy.” As a result, such pages are treated as though they were written in invalid markup, and therefore will be improperly rendered in modern browsers even if the XHTML and CSS are coded perfectly.
A web page that is without a DOCTYPE, with an older DOCTYPE, or with a typo-riddled DOCTYPE triggers quirks mode. So, when coding pages, make sure to check that the DOCTYPE is both added to the page and typed correctly to ensure that browsers do not render pages in quirks mode.
If a web page has an HTML5 DOCTYPE, modern browsers will trigger standards mode, even though the actual markup isn’t coded with HTML5 elements. Internet Explorer for Windows 6 and 7 ignores HTML5 features.
Using newer DOCTYPEs such as HTML5 is an option. However, it’s not the only option. Unlike software application releases, newer DOCTYPEs don’t make older DOCTYPEs moot.
For example, you would be hard-pressed to install, much less run, Photoshop 4 on today’s computers. However, you can still use HTML4 syntax and DOCTYPEs without fear of browsers not rendering your content.
The Solution provides an example of a relatively short HTML5 page. However, an even shorter and valid example can be made:
<!DOCTYPE html> <title>Small HTML5</title> <p>Hello world</p
These three HTML elements validate for HTML5 by checking out the page at http://validator.w3.org/check?uri=http%3A%2F%2Fjsbin.com%2Fowata&ss=1.
HTML5 specification for DTD at http://dev.w3.org/html5/spec/Overview.html#the-doctype; HTML 4.01 specification for DTD at http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3; W3C validators at http://www.w3.org/QA/Tools/#validators; DOCTYPEs article from A List Apart at http://www.alistapart.com/articles/doctype/; Article from QuirksMode at http://www.quirksmode.org/index.html?/css/quirksmode.html; Mozilla’s information on quirks mode, which explains the differences between the rendering modes and how it handles quirks mode, at https://developer.mozilla.org/en/Mozilla's_Quirks_Mode; Opera’s DOCTYPE page at http://www.opera.com/docs/specs/doctype/