My First Steps Into HTML5
Today I started coding on my first HTML5 project.
This new standard is very promising, it makes code a lot more semantic and readable, and it also makes our life easyer (or at least, it will eventually).
I started on reading some resources, the most important are listed below:
http://diveintohtml5.org/semantics.html
After this, I set up a structure in HTML5, and started the coding. I quickly found that even firefox font apply CSS to the new <article> and <section> elements.
I solved this by adding <div>’s to my structure, like this:
<article><div class=”article”></div></article>
You probaby think, okay then what’s the point of using HTML5 at this moment? Well, I thought the same and had a discussion about this with a friend of mine.
He stated that, even though it takes more lines of code and not all browsers support it right now, it is still worth the effort.
There are two reasons for this:
- Your websites will be ready for HTML5 when it will be broadly supported by all browsers.
- It will improve the readability of your code (also for search engines!).
Because of this, I was convinced that it is a good thing to start implementing HTML5 in my code.
I encountered another problem, and you can guess: it’s IE. Internet Explorer does not understand any of the HTML5 properties, so you have to use JavaScript to force it to understand it.
This is achieved by the following lines of code:
<!–[if IE]>
<script src=”http://html5shiv.googlecode.com/svn/trunk/html5.js”></script>
<![endif]–>
This makes sure that when the client is using IE, it will load the JS that make HTML5 work (thanks to htm5shiv).
You can take a look at some of the code I wrote today here, I hope this post helped your HTML5 efforts!
Continue Reading...
This is the blog of Gerben van Dijk. Front-end developer, music and movie fanatic, photographing enthousiast.