Without going into the discussion of why HTML 5 is available today and not 2022, this article is going to give you a series of HTML 5 boilerplates that you can use in your projects right now.
HTML 5 in 5 seconds
It’s über easy to get your markup to validate as HTML 5 — just change your DOCTYPE from whatever it is now to this:
<!DOCTYPE html>
That's it! It doesn't require anything more than that.
Google are doing it already. Check out their homepage, written all in one line:
<!doctype html><head><title>HTML 5 - Google Search</title><script>...
Ironically, Google's search and results pages don't validate because of their use of invalid tags like <font> and a number of other errors, but that's okay. They can still take advantage of the HTML 5 parsing rules (e.g., no type attribute on the <script> element) by using the correct DOCTYPE.
HTML 5 minified
If you like to knock out quick prototypes or experiments that don't require much styling, you might be interested in a miniature document in HTML 5:
<!DOCTYPE html>
<title>Small HTML 5</title>
<p>Hello world</p>
That's completely valid HTML 5 too.
(Interestingly, there was some disagreement about this pattern's validity when I removed the <title> tag. Hixie's DOM viewer says it's fine, and so does the W3C validator as long as the markup is entered manually. But Henri Sivonen's validator says it's invalid without the <title> tag. The W3C validator also says it's invalid when you give it a url. Hopefully, this will get sorted out soon.)
HTML 5 complete & compatible
This final, more complete boilerplate also indicates the character set. Without it, some characters will not render properly (and I've spent too much time in the past trying to work out why!).
We're also including the HTML 5 shiv so that we can style elements in IE. Note that you must include this script in the <head> element.
Finally, we're adding a few CSS rules to cause the new block-level elements to render as such, since some browsers don't know about them natively.
So here it is — a valid and complete HTML 5 document boilerplate:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML 5 complete</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, details, figcaption, figure, footer, header,
hgroup, menu, nav, section { display: block; }
</style>
</head>
<body>
<p>Hello World</p>
</body>
</html>
If you want to experiment with HTML 5, the default JS Bin template is an HTML5 boilerplate for you to play with too.