Migrating your web page to HTML5

Nowadays HTML5 is a web trending topic, and it's normal to hear about it in most of web conferences and read about it in HTML or general web books. But, what is HTML5? A programming language? A set of tools? Is it the panacea for web developers?

Here, I will not answer for these questions. I just want to respond a simpler question: how can I adapt my HTML pages to convert it in HTML5 pages?

I'll write this post in reverse: first of all the solution and then the reasoning to reach it.

Migrating our page to HTML5 is as simple as changing its doctype declaration. Nowadays we have a doctype declaration like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>A simple Lorem ipsum web</title>
  </head>
  <body>
    <p>Lorem ipsum dolor set...</p>
  </body>
</html>

We have to replace our doctype:

<!DOCTYPE html>
<html>
  <head>
    <title>A simple Lorem ipsum web</title>
  </head>
  <body>
    <p>Lorem ipsum dolor set...</p>
  </body>
</html>

Et voilĂ ! We have our web page migrated to HTML5! Is it simple, nor? Now I will explain you why.

The doctype is the element that marks what type of language you can use, which elements you can use to build your pages, so, it marks what document type it is. If you asume this and you understand that HTML5 is build on top of HTML4, ie HTML5 support all of HTML4 elements and controls and add some new features, you can see that this new page is an HTML5 page. HTML4 is a subset of HTML5 so any page in HTML4 with the HTML5 doctype it's already an HTML5 page. Easy!!

But HTML5 have a lot of new features that you can learn. Here are some resources: