New Elements in HTML5

One of the major new features in HTML5 is a range of new semantic elements, extending the suite far beyond its roots in marking up scientific documents with headings, lists, and paragraphs. Most of the new elements are aimed at giving a page better structure and developers more options for marking up areas of content than just using a div with an associated id or classes.

Here’s one example. In the past, developers might have used this:

<div class="article">…</div>

In HTML5, they have the option of using this:

<article>…</article>

The W3C’s HTML5 spec lists ten structural elements. Of these, three already existed in HTML4: body, h1–h6 (if we cheat a little and count them as a single entity), and address. Of the seven new ...

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.