Introduction to HTML5

HTML5 is the next version of the HTML standard and is developed by W3C and WHATWG. After HTML 4.01 was released W3C started to work with XHTML 1.0, which have the same elements as HTML 4.01 but gives us a XML compatible syntax. They continued with XHTML 2.0, which should have many new elements, and wouldn´t be compatible with XHTML 1.x at all. Meanwhile a new group called WHATWG (Web Hypertext Technology Working Group) started to work on a new separate standard called Web Applications 1.0, which should be a natural next step of HTML 4.01.

Since XHTML 2.0 received a lot of critics because of the complexity and lack of compatibility with XHTML 1.x, W3C decided to stop working on that and instead cooperate with WHATWG on Web Applictions 1.0, which became HTML 5.

Same same, but different

Many advocates of XHTML thinks that HTML will again make the web more incompatible because of the possibility to write sloppy HTML since you don´t need to have apostrophes around attribute values, and other things that is required according to the SGML standard. Because of this, you will be able to write HTML5 in two different ways, with HTML syntax and with XML syntax. The latter requires you to send the document with the correct MIME type (application/xhtml+xml), which isn´t supported by Internet Explorer 8 and earlier versions (Internet Explorer 9 supports this). If you use the HTML syntax, the pages should be delivered as text/html like earlier.

Why HTML5?

HTML 4 has been used by developers since the 90’s, and it became a standard in 1999. If we want to have more advanced content, we can use Silverlight, Flash and other plugins to do what we want. So why should we care about HTML5?

We need HTML5 since it´s a modern standard which correlates to how we created modern web sites, and makes it possible to view those pages on all platforms. If you are dependent on a plugin, you can´t be sure it will work on your phone for example. By using HTML5 we can use the same web site on all platforms to view videos, play games, listen to music, create advanced web based applications etc. That is why we need HTML5 now.

News in HTML5

There are a lot of new features in HTML5 that makes it possible to write modern standard compliant sites. HTML 4.01 became a standard in 1999 when almost everyone had slow modems. What have happened since then is that we have got much faster connections, which makes it possible to watch videos, plays music and other things on the web.

Some of my favorite new features in HTML5 are:

New HTML elements

The specification contains some new elements such as section, nav, article, aside, hgroup, footer etc. They will make it easier to group the content instead of using div elements with corresponding id´s.

Video & audio

Thanks to the new video and audio elements, we will be able to play video and audio on the web site without using third party plugins. So far, there are no specific formats in the specification, so it´s up to the browser vendors to choose what to support.

Canvas

With canvas, it´s possible to draw objects on the browser without the need of images (you can use images in canvas though). Thanks to the hardware acceleration in Internet Explorer 9, we can create games and applications using canvas. If you want to use audio in your game you could use the audio element.

Inline SVG

SVG have been a standard for a while, but with HTML5 we will be able to use inline SVG in our documents instead of using separate SVG files. Like canvas, we can draw images in the browser, but the difference is that canvas uses JavaScript, and SVG is XML based and used to draw vector images.

New input types in forms

When we create forms on web sites today, we often use JavaScript with strange regular expressions to validate the input. If you require a date you might add a calendar using JavaScript. In HTML 5 there will be new types of input elements like date, datetime, email, phonenumber etc, which makes it possible for the browser to validate the input. In that way you won´t need to care about it (except for the validation on the server side of course).

New JavaScript APIs

Except for the HTML of HTML5, there are some related specifications that are often included. These are not part of the HTML5 standard per se, but separate specifications. These are Selectors, Web Storage, Web Sockets, Web Workers, Geolocation, Offline Web Applications and many others. Even Internet Explorer 8 had support for both Selectors and Web Storage, which means many users can take advantage of these right away.

The future of HTML5

Since HTML5 is still under development, many developers wants to know when it will become a standard, so… When? The specification is estimated to be a recommendation in 2022. Yepp, 2022. It may sound scary, but don´t forget that not even CSS 2.1 is a recommendation yet. The Candidate Recommendation (feature complete, and only really important changes will be made) of HTML5 is supposed to be released in 2012. If a Candidate Recommendation is going to be a Recommendation, at least two full implementations are needed.

Get started today

To prepare for HTML5 you can download Internet Explorer 9 Beta 1, which has support for many new HTML5 features, such as video, audio, inline SVG and Canvas. It also supports many new features in the coming CSS 3 specification.

Internet Explorer 9 Beta 1 can be downloaded here:
http://windows.microsoft.com/en-US/internet-explorer/download/ie-9/worldwide

No Comments