Microdata

HTML5 has addressed the semantic issue with the creation of a simple syntax called microdata. This is essentially a series of name-value pairs that provide meaningful machine-readable data. As always, before trying to explain it, showing you how it works is easier:

<p itemscope>I live in <span itemprop="city">London</span></p>

This markup creates a single item. The attribute itemscope is used on the containing element to mark the limits, or scope, of this particular item. Inside we have the name-value pair, known as a property: The value of the itemprop attribute is the name—which, in this example, is city—and the element’s content is the value—in this case, London. The result is an item with a single property:

city: 'London'

But you’re ...

Get The Modern Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.