Photo of Nathan Shubert-Harbison Nathan Shubert-Harbison

html

Main content

Using the HTML5 custom data-* attribute

There are a lot of exciting new features in HTML 5. Video, audio, and canvas seem to be the most discussed around the watercooler, but the data-* attribute—though seemingly less earth shattering—is extremely useful.

data-* what?!

The data-* attribute is a way to store custom metadata about an element within its own markup. In the past we might have done this with a class or the rel attribute, but data-* gives…