The age of HTML5 has arrived and it’s time that we should all be using it, however, in your rush for the “next cool thing” please do not brush accessibility aside.

At the start of 2007 Andy Budd wrote a post (yes, I intentionally copied it’s title) looking forward to the future of HTML with some ideas about how it might evolve. At the time, the WHATWG were working on a draft specification that would become HTML5 and eventually be accepted by the W3C. We knew that change was required to keep the aging HTML family alive. Oh how we longed for change.

Finally, two and a half years later, change has arrived and people are starting to use HTML5 in real websites (I quickly converted this very website to HTML5 recently). HTML5 isn’t just something to experiment with and talk about, it’s something that you can use right now, even on client websites.

This is where I should take a minute to quickly dispel two commonly held but incorrect beliefs about HTML5. First, HTML5 does not mean the end of XHTML. HTML5 served as application/xhtml+xml is XHTML and is completely valid. This is why you sometimes see HTML5 referred to as XHTML5 or more commonly, (X)HTML5. Second, you most definitely are allowed to use XML syntax in HTML5 even if you are serving it as text/html. The HTML5 specification allows HTML to use either the SGML syntax as in HTML4.01 or XML syntax as in XHTML1.0. I prefer the later, but the choice is yours.

What is this HTML4.5 thing, anyway? HTML4.5 isn’t a specification (although it wouldn’t hurt to become one); it’s just a subset of HTML5 that is compatible with older browsers. So it is HTML5 and not HTML4 but I thought that HTML5-0.5 sounded kind of silly. While all major browsers seem to have no trouble with the HTML5 doctype, all versions prior to Internet Explorer 8 and Firefox 3 (and therefore Camino 2 & Flock 2) do not support the new HTML5 elements. These browsers combined may represent up to 32.2% (W3Schools browser statistics, July 2009) or a third of web browsing.

There are some techniques that allow you to style the new HTML5 elements in browsers that don’t natively support them, but not they’re not so easily implemented. Internet Explorer techniques require the use of JavaScript (up to 5% of users either have JavaScript disabled or it isn’t supported by their browser). Gecko browsers (Firefox et al) require that the page be served with the application/xhtml+xml mime-type, which will cause a page to not display at all if there is even a single validation error.

So what can you use? Basically you can safely use any element that exists in both HTML4.01 and HTML5. For a quick reference, checkout W3School’s HTML5 reference list. I’ll follow this post up with another more detailed post soon. You can also use some of the new HTML5 form input types. All major browsers, if they do no recognise the input type, will default to a text input field. Obviously you aren’t going to get any new UI features, but it can make your JavaScript-based form validation a little cleaner.

HTML4.5, because HTML5 is ready now… just not all of it.

  • HTML5