This year HTML5 truly rocked. Oli Studholme, one of the HTML5 Doctors, runs through 20 of the best sites and covers semantics, audio, client-side web apps, canvas as well as SVG and WebGL and looks ahead to the future
2011 has been an amazing year for HTML5 and the web. We’ve seen HTML5 continue maturing, progressing to Last Call status in May and on track to be a W3C specification by 2014. The WHATWG have been busy with both improvements to HTML5, and new post-HTML5 features such as WebVTT. The progress for browsers has also been staggering, with all five main players actively pushing the boundaries of the web, and Firefox joining Chrome, Opera, and to a lesser extent Safari in frequent, automatic updates. One more to go!
1. HTML5 For Web Developers
HTML5 for Web Developers might seem like a strange site to include here, because it’s just a version of the HTML5 specification. Historically W3C specifications have tended to be confusing, written for people who make web browsers, not websites. However, the HTML5 spec text is surprisingly readable, and peppered with examples. If you’ve had bad experiences reading W3C specs in the past, you might be pleasantly surprised.
HTML5 For Web Developers was made by Ben Schwarz and friends to be “a companion specification for web developers to use on a regular basis”. It’s a restyled version that drops the “implementor notes” for browser makers, perfect for web developers. Under the very readable print-influenced styling are some nice HTML5 additions too. It uses Offline Cache, and saving it shows a progress bar in supporting browsers using
<progress> and the AppCache API. The search-as-you-type feature also works offline, and of course the search box uses
It also represents how we can all make a difference. Ben did this as a volunteer project, and the source is on GitHub. And as web devs we have the skills to do so! Which takes us nicely into …
2. Move the Web Forward
Move the Web Forward by Mat Marquis, Aaron Forsander, Connor Montgomery, Paul Irish, Divya Manian, Nicolas Gallagher, Addy Osmani and friends shows you how “you can make the web as awesome as you want it to be”. It lists a range of things for all abilities that you can do to make the web better.
The one-page site features clean HTML5 code, using data-* attributes to tie in Twitter hashtag searches. It also has an adorable but invalid doctype:
<!DOCTYPE html public "i ♥ the web">
(The important bit is
<!DOCTYPE html, which triggers standards mode.) But above all, more than any of these awes HTML5 websites, Move the Web Forward’s message is crucial. In Beyond the Blue Beanie?, Stephanie (Sullivan) Rewis comments “As the saying goes, many hands make light work. How fantastic would it be if there were so many hands that the burden didn’t fall on just a few? Together, let’s make the web rawk even harder!”. You can read more in Addy Osmani’s The Smashing Guide To Moving The Web Forward.
3. Boston Globe
Scott continues “We used HTML5 for a number of reasons. Mostly, it’s future-friendly and offered features that were useful in our feature set. For example, we made wide use of
data- attributes for configuring behavioural options or associating content enhancements, we also appreciated the ability to use newer semantic elements in place of div/p/span where they made sense.”
4. Anatomy of a mashup
The audio of his mashup of Definitive Daft Punk is visualised using the
<audio> API and
<canvas>, with support from CSS3 transforms and transitions. Cameron says “All of the waveform and spectrum visualisation is performed in realtime, so your browser is rendering a music video on the fly!” Proving that Flash isn’t dead yet, Cameron used a custom Flash app to get the audio spectrum data.
SoundCloud is a service for recording and sharing sounds, and is a popular way for artists and DJs to share mixes and expand their fan base. It’s also a great case study in pragmatic use of HTML5. While the desktop web app uses Flash to play audio, there’s an option to use HTML5 Audio in settings. This has also allowed SoundCloud to support the iPad, and they’ve recently released an HTML5-based widget.
In addition to
<audio> and the Audio API, they also use
data-* attributes heavily, plus Canvas, SVG, and LocalStorage. Matas Petrikas says “We are especially proud of our use of Canvas in rendering of the widget waveform, the optimisations helped us to reduce the CPU load compared to Flash significantly”. Unfortunately there’s also some user agent sniffing (albeit for pragmatic reasons), and little use of new HTML5 elements or form attributes (although this is changing).
However, HTML5 Audio is not the default due to what Matas describes as “the poor state of HTML5 Media API implementation in web browsers”. To combat this Toms Senart and Yves Van Goethem created the audio test suite “Are We Playing Yet?”. Matas says “The response has been overwhelming, we already have most of the browser makers participating, and we look optimisticly towards 2012!”
Additional problems in mobile devices include recording sound, the lack of widespread support for
position:fixed for UI, and the lack of frequent (or any) mobile browser updates – Android WebKit is becoming the modern IE6. Because of this SoundCloud heavily promote their native apps to iOS and Android users. Matas says “we want to offer users the best experience possible, and currently the mobile browsers are still behind”. However, the future still holds promise: “we are big advocates of the upcoming device API (getUserMedia) and we hope in future to be able to capture sounds in the browser without Flash”.
These areas highlight some current problems in both specifications and browsers, but it’s certain both will continue to improve rapidly. For example Mobile Safari now supports background audio, GeoLocation and accelerometer. Even with the problems Matas says compared to Flash making the HTML5 version “was a pretty fast process. Debugging and optimising were also easier. This allows us to build and iterate faster, and in the end our users are happier too!”
6. The Wheels Of Steel
The Wheels Of Steel by Scott Schiller is two turntables and a mixer, live in the browser.
It uses a raft of HTML5 and related goodies, including CORS (cross-origin resource sharing), localStorage, the History API, the Selectors API, data-*,contenteditable, and inline SVG. Lea’s considering using the Drag & Drop API for resource embedding and the Offline API in the future, but says “the offline API is a huge pain in the arse". She also tried using Web Workers for asynchronous syntax highlighting, but this made it seem slower. She’d also love to use the currently-being-specced UndoManager API once it is implemented, as “a big portion of dabblet’s code is devoted to recreating Undo/Redo”.
It also uses Lea’s controversial -prefix-free library to handle CSS vendor prefixes automatically. Lea’s considering a no-prefix-free option, or potentially adding something like LESS. While Eric Meyer has eloquently stated the case for vendor prefixes, Divya Manian, Henri Sivonen, and Lea have all written on how vendor prefixes – as currently used (copy, paste, forget) have problems. While not HTML5, it’s an interesting issue about a fundamental part of how we work, and the CSS Working Group would welcome input via www-style.
Because the target audience are web developers, Lea hasn’t worried about backward compatibility. “If it was for a less tech savvy audience where IE is a concern, I’d still use HTML5, but with proper polyfills and fallbacks in place.” On HTML5, Lea says “HTML5 means three things for us developers: speed, universality, and openness. Making cool things is now easier than ever.”
8. Font Dragr
font dragr by Ryan Seddon allows you to preview custom fonts in the browser by simply dragging a font file from your computer into font dragr, or choosing from a list. Even better, you can use the font dragr bookmarklet and change the fonts on any site, targeting each font using a CSS selector. This lets you preview and compare fonts for
@font-face use quickly, leaving the coding until you’ve decided.
It uses new HTML5 elements, the Drag and Drop API, the History API, the
contenteditable attribute, and localStorage. Support for Google Web Fonts is also in the works. Ryan says localStorage is used to “do an ajax request which will get the view html, replace it in the DOM and then cache that view html in localStorage. So it only needs to do a network request the first time around.” On HTML5, Ryan simply says “it is the future”.
While not part of the HTML5 spec, some amazing sites have also been making great use of this powerful vector drawing specification.
9. Slavery Footprint
Slavery Footprint is an interactive survey that answers the question “how many slaves work for you?” to raise consciousness about modern-day slavery.
10. Kern Type
Kern Type is a type kerning game by Mark MacKay that is strangely addictive. You try to move the letters in a word to correctly kern them, and are scored on how well you did. Each word is in a different font too.
data-* attributes for font data (the initial positions and the x-height), and Raphal’s drag-n-drop for interactivity.
11. SVG Girl
SVG Girl is a demo site produced for the Internet Explorer 9 release. It showed off IE9’s SVG powers with a very Japanese flip-book type animation running at 10 SVG frames per second, with sound via the
<audio> element and an intro
I’ve yet to see any Japanese schoolgirls experiencing such a transformation while using Windows Phone 7.5, but hey it’s Japan — anything is possible ;) For another interesting Japanese example, have a look at The Shodo, a
<canvas>-based traditional calligraphy web app, that stores stroke info as SVG paths.
Peoplemovin is a personal project from Carlo Zapponi to show migration flows across the world, based around a flow diagram (inspired by Sankey diagrams). More than 215 million people, three per cent of the world population, live outside their countries of birth. Peoplemovin makes it easy to investigate migration by country, with intuitive visual representations explaining the statistics.
Carlo says “The foundation of the website is the canvas, all the interactions and visualisation happens in the space of the canvas that let me draw the connecting lines between the countries. I also used some CSS3 rules for rounded corners, shadows and glows and fonts.” In addition to the latest browsers it also works on smartphones and tablets. Carlo ended up making his own open-source toolkit called DataMovin to achieve this, which he plans to release at some stage (check the source in the meantime).
Describing HTML5, Carlo says “What’s great about HTML5 is that it is the perfect platform for creativity. You have a new crazy idea? Great! In a shorter time than ever before you can build anything into the browser without reinventing the wheel every time.”
13. Rally Interactive
Rally Interactive’s website contains a masterful example of creatively using canvas for interactivity. The triangular shapes react to hover and click in a way that until recently would have required a plugin like Flash.
As Wes Pearce says “We simply couldn’t have gotten the effect we wanted for our site without the HTML5 canvas. Support for the canvas in the latest browsers is shockingly uniform. We also put the new History API to good use, and were surprised at how quick it was to implement.”
14. Up and Down the Ladder of Abstraction
<canvas> examples are injected into the essay, allowing you to interactively learn about the point being made. I think this kind of thing is going to be a major part of future educational books, making ePUB 3 and HTML far superior to PDF, ePUB 2, and Kindle Format 8.
As with Agent 008 Ball and Pirates Love Daisies from 2010, it’s a great example of the combination of canvas and audio plus talent – a fun game that runs right in your browser. It’s also available in the iTunes, Chrome and Android stores, plus as a Facebook game, all from the same codebase. That’s the kind of reach native apps just don’t have.
WebGL is again not part of the HTML5 spec – it’s a separately specified API that allows 3D graphics to be used in
<canvas>. However, for crazy eye candy it’s hard to beat. Rather than go into details, let’s just see some examples:
17. WebGL Shader — Travelling wave fronts tech demo
The travelling wave fronts tech demo is a “fine-tuned 8bit reaction-diffusion system with added traveling wave fronts and subpixel decay”. Mesmerising.
18. ROME “3 Dreams of Black”
ROME “3 Dreams of Black” is an interactive music video by Chris Milk and friends, to music by Danger Mouse, Danielle Luppi and Norah Jones.
Don’t miss their tech demos and video about the technology behind the movie.
You can learn more about WebGL, and see more amazing examples, in Dev.Opera’s “An introduction to WebGL” (and “Porting 3D graphics to the web”) by Luz Caballero. Opera is also preparing a comprehensive list of WebGL tutorials, coming “very soon”.The future / the present
There’s a lot of amazing stuff coming to the web stack too. Let’s look at just one example – the WebRTC (Real-time communication) specification (
getUserMedia). This allows you to “exchange real-time, interactive media, including audio and video”, with a major use being video chat between browsers. Opera also has experimental support for
getUserMedia in developer builds for both desktop and mobile.
19. Browser-based video chat
20. Face detection/moustache demo
Opera also has experimental support for WebRTC, and the DeviceOrientation Event specification, in a custom build called Opera Labs Camera and Pages. Rich Tibbett wrote Native webcam support and orientation events on using both specs, and made a demo using WebRTC that performs face detection on live video. If that isn’t awesome enough, it also allows you to add a moustache. To live video. In the browser.
Bravo, interwebs. Bravo.Conclusion
As you’ve no doubt noticed by now, despite grouping these websites by an HTML5 technology they use, they’re all using way more than just one. While not everything is ready for adoption, there’s a lot of goodness in the HTML5 specification (and other web stack specs like SVG and WebGL) that you can use right now. Keep up to date and find out more at HTML5 Doctor, the W3C’s Planet HTML5 and on Twitter with @HTML5.
The “HTML5” buzzword has been a double-edged sword, but it’s helped the bandwagon gain momentum and made an impression on management too. Hopefully with this pile of inspiration you’ll return to the first two sites in the article, go forth and make awesome!
So what sites using HTML5 rocked your world in 2011? Let us know in the comments!