Programming - - By Craig Buckler

5 Reasons Why You Can Use HTML5 Today

In our recent poll, almost half the respondents stated it was too early to use HTML5, while 3% claimed they would never use it. While risks exist, there are several good reasons to invest in HTML5 today.

1. The HTML5 Specification Will Never Be Complete

Perhaps that’s an overstatement, but let me explain further…Developers understand software specifications and few would be willing to cut code based on a draft document; however, the HTML5 specification is different to your typical software specification. The W3C is no innovator: it does not lay down rules for browser vendors to follow. Vendors lead the way and their technology ideas are ultimately accepted, rejected, or tweaked to become part of the W3C specification.It’s highly unlikely the HTML5 specification will ever be fully complete. The only point when it could happen is when vendors and the W3C draw a line in the sand and move onto HTML6 (or whatever they name the next standard). If you wait for the final HTML5 specification, you’ll miss out.

2. HTML5 is HTML

Unlike the failed XHTML 2.0 specification, HTML5 is an evolution of HTML4/XHTML 1.0. You know most of it already. There are 28 additional tags and a few new techniques, but you won’t be using a completely new mark-up language.Development tools are a little difficult to find, but validators are starting to appear — validator.nu is one of the best.

3. Legacy Browser Support is Rarely a Problem

Firefox, Chrome, Safari, and Opera can all use HTML5 today. The users of those browsers tend to upgrade quickly, so there’s little need to worry about old versions that could implement bizarre parsing rules.That leaves us with Internet Explorer. It does not recognize the new tags, but can be forced to parse them if you add a JavaScript shiv to your page which ‘creates’ the associated HTML5 elements, for example:

document.createElement("header");document.createElement("footer");document.createElement("nav");// etc, etc…

Include the following code in your page head and IE6, 7, and 8 will magically become HTML5 aware:

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

This won’t help the browser understand technologies such as audio, video, and SVG. In those situations, you’ll need to use a fallback such as Flash, but I suspect we’ll be doing that to support legacy browsers for many years to come.

Tip: HTML5 Inline Elements

Most browsers, including IE and Firefox, assume the new HTML5 elements are inline by default. Since you’ll almost certainly want an element such as header to be a block-level element, remember to use display: block; in your CSS.

Now I suspect some of you are thinking: Whoa! Hold on there — what about accessibility? What if my IE user has JavaScript disabled? A fair point, but realistically, how many people does it affect? IE9 will support HTML5, IE’s market share shrinks every month, and I suspect many IE users can’t disable JavaScript even if they wanted to. Besides, if you’ve already abandoned IE6, that would have affected a far larger proportion of users.Even if non-JavaScript IE users are an important part of your demographic, the worst that will happen is that new HTML5 elements will be unstyled. The page may look bad, but the content and functionality should still work.

4. HTML5 is Happening

Despite the fact that HTML5 has become a loose marketing term like Web 2.0 or Ajax, all the main browser vendors are supporting the standard. They may have their own reasons and agendas, but HTML5 is here today and browser support will continue to improve and evolve at a rapid pace.

5. Don’t Be Left Behind!

HTML5 means different things to different people. To most web developers, it’s an incremental evolution of HTML, so it’s less exciting than periphery technologies such as SVG, canvas, standardized audio/video, geolocation, and so on.Many of your clients and possibly your boss will have a different opinion. To them, HTML5 is the white-hot technology they saw mentioned in the business press; it’s in the iPad so it must be cool. So develop a few HTML5 pages now: you’ll become a guru, be the envy of your peers, and will keep ahead of the game!

tip: Psst … wanna learn HTML5?

SitePoint is running a new HTML5 Live course with John Allsopp starting July 26. See you there!

Sponsors