HTML 5 Preparation

When setting up an HTML 5 web page, there are a couple of things which need to be done. First of all you need to standardise the CSS for the new HTML 5 elements. This can be done at the top of your CSS stylesheet by making all the new elements be displayed as “block” elements:

article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{
  display: block;
}

Unfortunately there is still a range of browsers which still don’t render HTML 5 objects. This means we need to add a JavaScript hack. Rather than downloading or creating your own JavaScript file, you may as well just link to a file that has already been created for you on Google Code. This means that it will always be kept up to date. Also as it is only needed for IE browsers up to version 8, you won’t need other browsers to load it:

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

You are then free to start creating your HTML 5 web page!

Leave a Reply