Supermighty

[Official] Stream of consciousness from a web programming, art admiring, lovable rogue.

HTML5 DocType

It is time we did away with all the old and ugly DOCTYPES and embraced the future in the HTML5 DocType. Allowing for forward compatibility down the road.

<!doctype html>

There are only two uses for the DocType:

  1. To trigger non-quirks mode (standard mode) to render the web page.
  2. To tell a validator how to check the page for conformance to an HTML level.

Web browsers do not actually check to see if the HTML is written in the version specified by the DocType. They really don't care. They just want to know which mode to render it in. You can send XHTML strict with an HTML4 strict DocType and it will render the same either way. The only purpose of the DocType for web browsers is to trigger non-quarks mode.

So will browsers reconize the new HTML5 DocType as one that triggers non-quarks mode? The answer is yes.?Firefox supports the new DocType as do the most popular browsers. Even Internet Explorer 6 will trigger standards mode when presented with an unknown DocType.

So the new DocType will trigger standards mode, but won't the browser ignore all the new HTML5 tags? The simple answer it to just not use the new tags and elements or the removed tags or elements. Without using either of those two sets you'll find that you still have most of the tags that you have used before when coding standard HTML401 or XHTML documents.

By narrowing the tags we use and creating clean markup we can embrace the future standard of HTML. This adoption will pressure browser makes to step up the pace for HTML5 support, and when the new tags become available we will be stragictly posed to easily update our pages simply by adding new elements to our pages.