Menu Search
Jump to the content X X

Today, too many websites are still inaccessible. In our new book Inclusive Design Patterns, we explore how to craft flexible front-end design patterns and make future-proof and accessible interfaces without extra effort. Hardcover, 312 pages. Get the book now →

Structural Semantics The Importance Of HTML5 Sectioning Elements

Whatever you call them — blocks, boxes, areas, regions — we’ve been dividing our Web pages into visible sections for well over a decade. The problem is, we’ve never had the right tools to do so. While our interfaces look all the world like grids, the underlying structure has been cobbled together from numbered headings and unsemantic helper elements; an unbridled stream of content at odds with its own box-like appearance.

Because we can make our <div>s look but not behave like sections, the experience for assistive technology (AT) users and data-mining software is quite different from the experience enjoyed by those gifted with sight.

Now that HTML5 has finally made sectioning elements1 available, many of us greet them with great reluctance. Why? Partly, because we’re a community which is deceptively resistant to change, but also because of some perceived discrepancies regarding advice in the specification. In truth, the advice is sound and the algorithm for sectioning is actually easier to use than previous implementations. Some developers are just very married to their old workflow, and they think you should be too. There’s no good reason why.

Make no mistake: Sectioning elements help you improve document structure, and they’re in the spec’ to stay. Once and for all, I will be exploring the problems these elements solve, the opportunities they offer and their important but misunderstood contribution to the semantic Web. If you’re unfamiliar with the concept of the “semantic Web,” this video2 is a great introduction.

Making Websites Link

My introduction to Web design was via a university course module called something like “2.1: Dreamweaver,” and I recall my first website well. I remember my deliberately garish choice of Web-safe3 colors. I remember it looking right only in Netscape Navigator4. Most of all, I remember hours of frustration from tugging at the perimeter of a visual layout tool named “table.” I had no idea at the time that this layout tool represented a type of annotation called an HTML tag. Furthermore, no one told me that this annotation invited my patchwork of primary colors and compressed JPEGs to be computed as a sort of demented Excel spreadsheet. In other words, I had no idea I was doing it wrong.

A Dreamweaver table
*Bites tongue*

The fundamental failure of most graphic, product, architectural, and even urban design is its insistence on serving the God of Looking-Good rather than the God of Being-Good.

– Richard Saul Wurman

Macromedia’s Dreamweaver didn’t make the creation of valid documents impossible, but it was one of a number of emerging GUI editors that pandered to our desire for visual expression more than it encouraged informational clarity. Dreamweaver, and other editors classified under the misnomer “WYSIWYG,” helped transform a standardized information system into a home for graphic design and enabled a legion of insufferable Nathan Barleys to flypost the World Wide Web with their vapid eye candy. I was one of many.

Web Standards Link

By the time I made my first website, the Web standards movement, promoting compliance, uniformity and inclusion, was burgeoning. I just wasn’t aware of it until much later. I didn’t have to be: Agency-based Web design was still mainly graphic design with a reluctant programming department clumsily bolted on. If you’re doubtful of the grip that this culture has had on the World Wide Web, look no further than the fact it took until 2010 (2010!) for us to concede that Web browsers are not really made of paper5.

When I finally became familiar with Web standards and the practice of “doing things right,” it was as someone who still worked primarily as a visual designer. Inevitably, my first forays into standards-based design revolved around mastering “CSS layout,” the practice of visually arranging content without relying on the semantically incorrect <table> element. We’ve held up <div>-based layout as a mark of quality for a number of years now. You might even say that it has become a time-honored rite of passage for graphic designers who are moving into “proper” HTML coding.

As I shall demonstrate, the <div> is the ultimate Graphic Design tool. By affecting only appearance, it licenses poor document structure and overengineered interfaces; all without making your document technically invalid. As such, it sanctions the worst kind of hacks.

The Problem With <div> Link

Every day, thousands of Web developers invoke the almighty <div> to divide, partition and ring-fence their Web pages’ content. We use the <div> to police content, to prevent disparate chunks of information from collapsing into each other. In truth, the <div> has no such power.

Consider the following example:

Two column layout with sidebar encircled with dark border

In this basic layout, I have included a body of text and an adjacent “sidebar.” To make it absolutely clear to the reader that the sidebar is tangential and does not belong to the main content, I’ve drawn a fat line around it using the border property. For those of you screaming, “That sidebar heading should be an <h3>!”, I’ll get to that shortly. All of my design decisions (the adjacent position, the border and the reduced font size) are facilitated by CSS alone. So, when I take the CSS away, I get this:

The same layout as before is now one column, no borders

Not only is switching off CSS the quickest way to make a Web page responsive6, but it’s a great way to see how HTML4 documents (which lack sectioning elements) are actually computed. In this case, our so-called “sidebar” is revealed to be just another raft of information in the linear flow7 of the document.

Why Is This So? Link

The reason for this is that the <div> is, and always has been, a flow content8 element. No matter how thick the <div>’s borders or how dark its background color, it does not stand apart in the structure of the document. Neither, therefore, does its content. With the CSS removed, the faux sidebar’s heading of “Resources” now seems less a distinct component of the page and more a part of the main content. To a parser or screen reader, it would have seemed this way all along.

For reasons of clarity, let’s look at a further example using a snippet of HTML:

<div class="parent">
   <p>Some content...</p>
      <div class="child">
         <h2>Another heading</h2>
         <p>Some other content...</p>

I’ve done something slightly different here by entering the two <div>s into a parent-child relationship: The div.child tag belongs to div.parent. We can certainly make it look that way with CSS, anyway. However, <div>s, to quote the specification, “have no special meaning.” Not only do they not mean anything semantically, but they have no impact on the computable structure of the page (sometimes called the “document outline9”). The <div>s we’ve used may as well be invisible; so, to get a meaningful map of the structure we’ve created, we should remove them completely. That leaves just four elements and reveals the parent-child relationship to be an illusion:

   <p>Some content...</p>
   <h2>Another heading</h2>
   <p>Some other content...</p>

As HTML coders interested in sound structure, we should be interested that the above reduction — which omits all meaningless elements — is what we’ve actually made, and it’s not what we set out to do: By not really belonging to “parent,” “child” has a different contextual status in the document than intended.

Heading Levels Don’t Really Help Link

It’s popular to believe that replacing the second <h2> with an <h3> would solve our problem. If we did so, we’d get the following, more dynamic outline:

  • A Heading (h2)
    • Another Heading (h3)

This solution certainly seems more purposeful, but is it the right decision? Should the second heading be a subheading within the same topic (an <h3>) or be the introduction of an entirely new topic (an <h2>, as we had in the first place)? Headings alone can only show where a piece of content starts, not where it ends, which makes it difficult to tell what belongs to what. We have to simulate belonging by choosing the correct heading level for the context. Just think about that for a second: We’re defining the content’s structural status by labeling it retroactively. It’s just begging to go wrong.

Lets have a look at the homepage of accessibility experts The Paciello Group. Naturally, it’s a highly accessible and pretty well organized site, but could the structure be improved with HTML5 sections? You’ll notice their use of a <div> to collectively wrap the three <h2>s, Software Developers, Website Owners and Mike Paciello. Since the <div> doesn’t computably contain these three blocks, the last <h2> and the following <h3> are allowed to pair off in this relationship:

  • Mike Paciello (h2)
    • Contact Us Now (h3)

Wait … so, “Contact Us Now” is a subtopic belonging to the larger theme of “Mike Paciello”. Can that be right? It certainly doesn’t look this way in the visual layout. It’s worth noting at this point that the <div> which fails to thematically group those three <h2> blocks has a class of class="region". Ironically, if this <div> had been a <section>, some screen readers would consider it a “region”. If a <section> had been used in place of the <div>, the observed relationship would not have emerged: The “region” would be self-contained. The class of “region”, however, is not taken into consideration in any meaningful way and does not affect the structure.

Okay, so that’s a weird one, but the situation only gets more confusing when we start to include items for which headings aren’t really even appropriate. Take this further example:

This layout has an h1, an h2 for content and an h3 sidebar with a footer div at the bottom

In my HTML4 page, I have an <h1> to introduce the document, an <h2> for the main content and an <h3> to mark the start of my “sidebar” (which is just a wishy-washy <div>, as in previous examples). The page follows long-standing convention by having an untitled div#footer resting at the foot of the document for copyright information and other such necessary evils. (It has to be a <div> in HTML4, because the <footer> tag doesn’t exist yet.) The question is, to which heading does the footer belong?

Most of us, based on appearances, would agree that the footer must belong to the document. That is what we’ve learned to expect. To the unsighted, it is a different story: Because there is no new introductory heading between the sidebar <h3> and the footer content, it could be extrapolated that these two components are as one (see image below left). By the same token, one could also argue that we’ve included the “sidebar” as a mere “break” from the flow of the main content, before returning to that flow at the advent of the footer (see image below right). This would make the <h2> the footer’s heading.

Red outlines show different interpretations of structure

The only decent chance we have of understanding the intended structure of the page is by inferring it from a reading of the content. Remembering that the whole point of a “markup language” is to make the structure of information easier to follow, I may as well have chucked the HTML and written my Web page on the back of a napkin.

Some accessibility gurus would suggest that you use a remedial <h2> to head the #footer and bring it back in line, marking up the end of the sidebar like so:

  • h1 (page)
    • h2 (main)
      • h3 (sidebar)
    • h2 (footer)

This kind of works as a hack, but it’s not really sound. Do you really want to make a big announcement of the footer — an announcement as big and bold as the one used to summon the main content, not to mention bolder than the sidebar? No. If our Web page were a film, the footer wouldn’t be the titles — it would be the credits. In HTML5, the <footer> element10 “contains information about its section.” This is semantically superior: We don’t use footers to introduce topics; we use them to conclude them. Accordingly, footers — unlike their parent sections in HTML5 — do not require headings.

Tweet reads: Marking up lots of headings in a page significantly dilutes a screen reader user's ability to navigate between parts of a page efficiently11

Just because the nesting level of headings is correct doesn’t necessarily make a page easy to read.

The closest thing we have to a “system” for structuring documents properly in HTML4 is numbered headings. Not only does this lead to ambiguity, as explained, but in practice we don’t really even use headings to define structure. We use <div>s to define structure and throw in some apologetic headings for accessibility’s sake. To make matters even worse, advice regarding the deployment of numbered headings12 isn’t even clear on whether we should use them in order (h1-h6) or not.

The loose coupling between headings and <div>s is inadequate. Now, with the introduction of sectioning elements, we still use boxes, of sorts, but boxes that actually say something on their own. We are making a move from merely implying sections (by labeling them) to letting them define themselves. Simultaneously, sighted readers and unsighted parsers can experience content that one has effortlessly divided into clear, manageable portions.

The HTML4 spec is very imprecise on what is a section and how its scope is defined. Automatic generation of outlines is important, especially for assistive technology, that are likely to adapt the way they present information to the users according to the structure of the document. HTML5 removes the need for <div> elements from the outlining algorithm by introducing a new element, <section>, the HTML Section Element.

Sectioning Link

Aware of our desire for legitimate elements to create computable sections, HTML5 offers <section>, <article>, <aside> and <nav>. Like some sort of obnoxious holiday rep’, I’ll introduce the topic of practical sectioning using these elements with a quick quiz. Study the following diagram. How many sections do you count?

An HTML5 page with header, aside and footer14

Multiple-choice answers:

  1. 1
  2. 2
  3. 3
  4. 4

The correct answer is (b), 2. We have included just one of HTML5’s new sectioning elements in the form of an <aside>. Because <footer>s and <header>s are not sectioning elements, what does that leave us with? The <body> tag is the outermost element, making the document itself a kind of section (a supersection, to be precise). So, there you have it: We’ve been using “sectioning” since HTML 1.0, just not with any subsections to speak of.

Some of you may have missed the clue earlier in this article and thought that <header> and <footer> were sectioning elements. Don’t fret; it’s not your fault. Whenever developers like myself try to explain HTML5 page structure, they usually brandish a diagram like the one I used above. In these diagrams, the boxes marked “header,” “aside” and “footer” exist in the same visual paradigm and occupy a similar area. They seem alike, you might say. The other culprit for this endemic confusion is the way the specification is written. Believe it or not, the document structure of some pages in the specification that refer to document structure is structurally unclear! This sort of thing sometimes happens when a standard is constantly evolving. The navigation tree for “4.4 Sections” found in this draft15 is laid out like so:

  • 4.4 Sections
    • 4.4.1 body
    • 4.4.2 nav
    • 4.4.3 article
    • 4.4.4 aside
    • 4.4.5 h1, h2, h3, h4, h5 and h6
    • 4.4.6 hgroup
    • 4.4.7 header
    • 4.4.8 footer
    • 4.4.9 address

You’d be forgiven for thinking that anything in this list qualifies as a sectioning element, absurd as some of them (<address>?) may sound. It’s only when you navigate to 4.4 Sections > 4.4.8 Footer that you’re told that “the footer element is not sectioning content; it doesn’t introduce a new section.” Thanks!

Despite these ambiguities in the spec’ itself, as well as in the surrounding publicity for HTML5, sectioning in practice just works. The following three axioms are probably all you’ll need to understand the algorithm:

  1. <body> is the first section;
  2. <article>, <section>, <nav> and <aside> make subsections;
  3. Subsections may contain more sections (subsections)

Aside from a few trifling details, that’s it. In a little while I’ll cover the completely unnecessary worry that is had over headings combined with sections. For now, let’s take another look at that example from before about footer ownership. This time, I’ll make a few HTML5 substitutions:

The diagram clearly shows the footer in the context of the document16

Note the lack of illustrated headings. Wherever a section is opened, it assumes responsibility for nesting: The heading type is unimportant. More on this soon …

The outline for this example looks like this:

  • Document
    • Article
      • Aside

Now that we’ve implemented sections, the boundaries are clear. Our document contains an article, which, in turn, contains an aside. There are three sections, each belonging to the last, and the depth of each section is reflected in the outline. Importantly, because sectioning elements wrap their contents, we know perfectly well where they end, as well as where they begin. And yes — screen readers like JAWS actually announce the end of sections like these! We know what content belongs to what, which makes deducing the purpose of the footer much easier. Because it exists outside the bounds of both the <article> and its <aside>, it must be the document’s footer. Here’s the same diagram again, with subsections faded out:

The same diagram with subsections faded out17

The power of sectioning lies in its ability to prescribe clearly defined boundaries, resulting in a more modular document hierarchy. The footer unequivocally belongs within the immediate scope of the highest-level section, giving assistive technologies and indexing parsers a good idea of its scope, which helps to make sense of the page’s overall structure.

Headings And Accessibility Link

When Sir Tim Berners-Lee conceived the <section> element all the way back in 199118, he envisioned the obsolescence of ranked heading levels. The thrust of the idea was that headings should act as mere labels for blocks of content, and the nature (i.e. the importance, scope, etc.) of the content would be calculated automatically based on the content’s standing in the document.

I would in fact prefer, instead of <h1>, <h2> etc for headings [those come from the AAP DTD] to have a nestable <section>..</section> element, and a generic <h>..</h> which at any level within the sections would produce the required level of heading.

Why is this preferable? Determining heading level systemically, based on nesting level, is much more dependable because it removes a layer of decision-making: By “producing” the required heading level automatically, we no longer have to decide separately which numbered heading we should include. It effectively prevents us from choosing the wrong heading level, which would be bad for parsable structure. A subsection must be subject to its parent section. Because this relationship between sections determines “level,” numbered headings are made redundant — hence, the proposed <h>.

A lot of fuss over nothing Link

Now, this is the supposedly tricky part; the part that causes all the consternation and gnashing of teeth. This is the part that caused Luke Stevens to write this diatribe20, and prompted Roger Johansson into a state of uncharacteristic apoplexy, asking, “are you confused too?21”. Ready?

In the WHATWG specification (in the same place where <footer>s were ostensibly classified as sectioning elements!), we are “strongly encouraged to either use only h1 elements, or to use elements of the appropriate rank for the section’s nesting level.” On first appearance, this seems contrary. Surely only one of these courses of action can possibly be right? What do you do? I’m thinking maybe the first option. Or the second. Who am I?

It certainly confused me, so I spoke with HTML Editor, Ian Hickson. He explained the outline to me in detail and I’m convinced it is perfectly robust. I’m going to do my best to explain it to you here.

Okay. As it turns out, we didn’t get the generic <h> element. This wouldn’t be backwards compatible because older browsers wouldn’t recognise it. However, headings that introduce sections are — regardless of their numbered level — treated as a generic <h>. Quite correctly, it is the section itself that takes responsibility for nesting in these situations — not the heading — and whenever you introduce a new section, you introduce a new nesting level without fail. What does this mean in practice? It means that we can introduce and benefit from the structural clarification offered by sections without abandoning heading levels. Take the following example:

<h4>Page heading</h4>
<p>Introductory paragraph...</p>
    <h3>Section heading</h3>
    <p>some content...</p>
    <p>content following subheading...</p>
        <p>content two levels deep...</p>
<h5>Another heading</h5>
<p>Continued content...</p>

Our heading levels are all over the place. This is not recommended by the specification, but it helps demonstrate just how robust the HTML5 outlining algorithm really is. If we replace all the headings that open sections with a generic (“wildcard”, if you prefer) <h>, things become clearer:

<h>Page heading</h>
<p>Introductory paragraph...</p>
    <h>Section heading</h>
    <p>some content...</p>
    <p>content following subheading...</p>
        <p>content two levels deep...</p>
<h5>Another heading</h5>
<p>Continued content...</p>

It’s important to note that the only errors revealed in the computed outline are ones relating to badly ordered numbered headings within the same section. In the original example, you’ll see that I’ve followed an <h3> with an <h2>. Because they are in the wrong order, the outline interprets them as being on the same level. Had I encapsulated the <h2> in <section>, this error would have been suppressed.

Well, how about that? If you’re not convinced, go ahead and paste my example into the test outliner22 and play around. It works just fine. In fact, it’s really difficult to break.

If you think there is a benefit to screen reader users, you may wish to adhere to the second of the two clauses from the specification and incorporate numbered headings that reflect nesting level. As demonstrated, this will have no effect on the outline, but since heading level (“Heading Level 2 – The Importance Of Sections”) is announced, it gives a clearer impression of structure to those who can’t see boxes inside boxes.

The assertation that heading levels are perpetually indispensable to screen reader users comes under pressure when you consider advancements being made by screen reader vendors. Screen readers like JAWS mark the territory of sections more clearly than headings, by announcing the beginnings and ends of sections and the thematic regions they represent (“Article End!”). From this perspective, using more than one <h1>s in your document might sometimes be applicable. You’ll come up against some accessibility experts who are keen on their “there can only be one [h1]!” mantra, but research shows23 that even in HTML4 or XHTML, this is not necessarily the case.

The approach you choose is yours to make; just employ some common sense and consistency. Bear in mind, though, that not all screen readers are able to announce the bounds of sectioned content. In these cases, there are measures you can take …

ARIA Enhancement Link

Transition to an HTML5 document structure is made smoother by incorporating some ARIA landmark roles24, which are both relatively well supported25 and somewhat analogous to the section-based navigation we should expect later. ARIA offers many more accessibility-specific features than baseline HTML5 could ever withstand; so, including “bolt-on” ARIA enhancements is certainly polite26. However, regarding ARIA roles as a substitute for semantic HTML would be a grave misconception.

Landmark roles, such as role="contentinfo" and role="banner", address accessibility only — not data mining — and each may be used only once per document. They are essentially shortcuts to parts of the page. HTML elements are more like building blocks, which are used in a repeated and modular fashion. So, while you can assist accessibility by placing role=”banner” into the <header> element closest to the document’s root, this does not preclude you from using <header> to introduce other sections:

The banner landmark role is used just once

Are Sections The New <div>s? Link

This is a common misconception.

If it wasn’t clear already, it should be clear to you now that <div>s are semantically inert elements — elements that don’t really do or say anything. If this is clear, then it should also be clear that, when building a structured document, relying heavily on “an element of last resort27” makes for a very poor foundation.

If the new <section> element, for example, was just <div> with a new name, adopting it would be a straightforward matter of search and replace. It wouldn’t exactly be progress, though. The truth is, <div> still has a rightful place in the spec’; we’ve just given its organizational responsibilities to a team of elements that are better qualified. Sorry, <div>, old mate. What do we use <div>s for, then? Precisely what they were good at from the beginning: as a tool for “stylistic applications… when extant meaningful elements have exhausted their purpose28.”

For instance, you shouldn’t employ sections as box-model29 controlling measures like this…

<section class="outer">
      <section class="inner">
         <h1>Section title</h1>

… because there’s nothing that the outer section does that the inner section doesn’t. We’ve created two sections for one piece of content. A quick run through our outliner30 throws the “Untitled Section” warning:

  • [Untitled Section]
    • Section title

The brilliance of <div> in this context is that it refuses to affect the outline, which is why we can use it without fear of reprisal. This…

         <h1&gtSection title</h1>

… averts disaster31 and results in this unsullied, if simplistic, outline:

  • Section title

Sections And Semantics Link

A lot of developers have trouble with the word “semantic.” You might even say that they don’t know what the word means, which (if you are familiar with the term) makes an interesting paradox. For instance, when Jeffrey Zeldman advocates32 for the “semantic” application of the id attribute, he’s kind of missing the point. The main purpose of semantic HTML is for the automated extraction of meaning from content. Applying a private, non-standard id to a <div> would not improve the semantics of the element one iota: Visitors can’t see it and parsers will ignore it. So much for the semantic Web33!

Sections are often characterized as the “semantic” equivalent of <div>. This is a half-truth at best, and I apologize for throwing the term “semantic” around so much — it’s become a bit of a shorthand. Some HTML elements are inherently semantic in that they prescribe specific meaning to their contents. The <address> element is a good example: When a parser reaches <address>, it knows that the contents should probably be interpreted as contact information. What it chooses to do with this knowledge is another matter, but it’s plausible that a screen reader could provide a shortcut to the address or a search engine could use it to refine its results pages.

Definition of syntax from Google search: The arrangement of words and phrases to create well-formed sentences in a language

Sectioning elements are not so much semantic as syntactic. All <section> tells us is that it is a part of a whole. However, the syntactic contribution of sectioning elements to document structure is not unimportant. Consider the following sentence: If sections you don’t websites your are use obsolete. A lot of recognizable words are in there, but the lack of sensible syntax makes the sentence difficult to unpick. So it is with sectioning: You are not creating meaning so much as assembling it. Meaning isn’t always about the “thing”; it’s sometimes about what that thing’s role is amongst other things.

Microdata Link

Efficient, syntactically sound data structures are worthless if they are semantically lacking. Fortunately, HTML5 has both angles covered and provides a mechanism for attaching semantic meta data34, called “microdata35,” to our structured content. Using microdata, and by consulting schema.org36, you can define a page’s content as anything from a scholarly article to an exercise regimen. Unlike classes and IDs, this is information that can actually be interpreted usefully.

Google's structured data dashboard
This microdata was found by Google and displayed in its “Structured Data Dashboard” for the WordPress theme Typical37.

Conclusion Link

HTML isn’t just an SDK or a Graphic Designer’s palette. It is a metalanguage, a language that tells you special information about information. Sometimes we — or, more precisely, the parsers we employ — benefit from added information about the subject, timing, origin or popularity of content. This is what APIs such as microdata and RDFa are for. Other times, the context, hierarchy, relative importance and codependence of the information are what need to be determined. This is where appropriate syntax, facilitated by sectioning elements, can be employed.

Some people will tell you not to bother with sectioning. They say that it’s hard work or that it doesn’t make sense. This is hokum. Sure, if you’re lazy, don’t bother with sectioning, but don’t pretend you’re doing it on principle. Using sections demonstrably enhances HTML structure without breaking accessibility. We’ve covered this.

Still, there will always be people who will attack this aspect of the specification. Perhaps we’ll enjoy some of these objections in the comments:

  1. They will point to bad implementations by specific vendors:
    These are bugs and bugs get fixed!
  2. They will cite the actions of large websites who don’t use sectioning elements:
    Just because large sites haven’t implemented sections doesn’t mean they wouldn’t like to. Since when does big mean ‘right’ anyway?
  3. They will flood you with examples of developers implementing sections badly:
    Some developers do stupid things and their misuse of HTML doesn’t stop at sections. I include myself here, by the way.
  4. They will present you with anecdotal evidence about user behavior within specific groups:
    It is expensive and impractical to address problems on a case-by-case basis. Fragmentation and complexity would also be inevitable: a loss for the majority of users.

I don’t think anyone would advocate making badly structured Web documents any more than they’d suggest building a house by stuffing a bag full of bricks and throwing it into a ravine. The case has been made and the specification bears it out: Sections aren’t just good for document structure — they finally make proper structure attainable. Some browsers and screen readers have some catching up to do, that’s for sure, but the situation is improving rapidly. Any kind of change is a little turbulent, but this kind is worth it.

Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37

↑ Back to top Tweet itShare on Facebook


Heydon is a designer, writer and public speaker. He works with The Paciello Group as a UX and accessibility consultant. His book, Inclusive Design Patterns, is available in hardcover and as an ebook from Smashing Magazine.

  1. 1

    Finally, a great article about sections. You’ve beaten W3C and HTML5Doctor. Thanks!

  2. 2

    Information has long overtaken natural selection as the driving force behind humanity’s continued survival. As this data that we rely on for our continued existence grows, we need it to be ever more structured, so that it may indeed be understood by the many – necessarily automated – processes for storing, sorting, and retrieving it. Beyond dubious use case studies and fashionable trends, it is the reader of the future that requires access to this information, and it’s more likely to be a machine than a human.

    So I guess my point is follow Mr Pickering’s advice, and mark up your stuff properly! :)

    • 3

      Heydon Pickering

      January 18, 2013 8:11 am

      Thanks for the – rather poetic – reply, Frank! You put it better than I did, and you’re right:

      It is the necessary involvement of automated parsers (which include AT-related interpreters) for which HTML and other metadata languages were conceived in the first place.

      Without structure, the Web isn’t the Web; it’s the Lump. This is as true for the relationships within documents as it is between them.

  3. 4

    That tool will definitely come in handy – I ran a few of my websites through it and saw that I have much work to do in improving the sectioning.

  4. 6

    How come you guys don’t have share buttons on the articles?

  5. 7

    Having read the multitude of very high level debates and arguments on this subject, and others akin to it, from both sides of the aisle I am ultimately left with the conclusion that in the grand scheme of things none of it really matters.

    Of all of the pages that exist on the world wide web probably fewer than 10% are actually built with the degree of uber-finess that is championed within these ‘academic circles’.

    I guess it’s all just analogous to university language courses and the relationship they have with people speaking in the street. None.

    We get up. We go to work. We design. We code. We try to do it well but when all said and done it has very little impact on the natural order of things. People build rubbish things and make lots of money. People build amazing things and make very little. People know very little and make a lot of noise. People know a great deal and are barely heard.

    That’s not to suggest that the inspired and enlightened do not deserve their platform, nor that their wisdom ultimately drives standards and marks the cutting edge but with something as richly complex and nuanced as design and language when all said and done there is no one right and no one wrong. It’s all just opinion of which there will always be a difference.

  6. 8

    Long story, short : Read the docs and learn from them. There’s no excuse for not reading the documentation. You can watch all the video-tutorials in the world and read every blog post on the Interwebs, nothing can explain a language/technology more accurate than it’s own documentation (except for the case in which the product and the documentation belongs/was written by Microsoft). Secondly, get your study-shoes on and start learning about ARIA ROLES. The rest, comes from passion, motivation, ambition and such !

    Great article, really well structured!

  7. 10

    Great read. I recently converted a site from meaningless divs to proper sectioning elements. I ran into a bit of confusion regarding the importance (or lack of importance) of heading elements inside of section elements. It just didn’t feel “right” to go back to h1 in a new section, but your explanation makes it very clear why this is, in fact, correct. Thanks also for explaining that header and footer are not, in fact, sectioning elements but rather contextually relative to their parent element. That clarifies why they can be used again and again in sections.

    The fact that all screen readers do not yet understand sectioning elements yet is really not important if we are coding for the web that is emerging rather than the one that is dying. I know there are some out there who think code should work for every conceivable user environment, but this is exactly the fallacy that sectioning elements correct.

    Also, a big thanks for the link to HTML 5 Outliner. That will help streamline the process in future projects.

  8. 11

    Thank you for the detailed explanation! :-)

  9. 12

    Andrew Shooner

    January 18, 2013 6:28 am

    In the end, any structural semantics are only as relevant as their use. The problem is that the manner in which they were developed, and the clarity of the spec, are both very lacking. We can’t all ask Ian Hickson for clarification when his spec fails to answer the question.

    Here’s an eye-opening recent critique of the process that created sectioning in the first place:

    • 13

      Heydon Pickering

      January 18, 2013 7:16 am

      The manner in which sectioning elements were developed is not a “problem”. It is an anecdote. The many and variant ways in which natural languages develop cannot possibly be accounted for in their entirety and yet, here we are, communicating perfectly well.

      I read Luke’s article and alluded to it here. Whilst it is a fun read, it is highly emotive and focuses on the culture and attitudes surrounding this part of the specification. It is a critique of the process, not the resulting product. I’m not interested in the history but the application so I have, instead, focused on the intrinsic qualities of these elements and their impact on HTML. I think Smashing readers deserve such an explanation.

      I’m sure Hixie would not like to be inundated with questions from every developer in the world, which is why I approached him on your behalf. Cheers!

      • 14

        Andrew Shooner

        January 23, 2013 6:38 am

        But isn’t the process used as rationale for the nature of the product? The intrinsic qualities of these elements are dependent upon their regular and uniform usage, which was meant to be a natural outcome from ‘paving the cowpaths’. It was supposed to say what we were all already thinking.

        In reality, as a developer, I find it challenging and frustrating to read the docs and determine what that usage is. Without more clarity, I’m not confident that we’ll see any sort of widespread uniform usage. I love the concept of sectioning, but I’ve been discouraged by the confusing nature of the details. For me, the feeling is reinforced by the fact that an article of this detail required explanation by the editor outside the spec itself.

        • 15

          Heydon Pickering

          January 24, 2013 9:15 am

          I like the way these elements are specified, so we can’t all have been thinking the same thing. QED.

          It is indeed a shame that I had to write such a long article and consult Hixie to explain sectioning elements, but this is grounds for changing advise in the spec’ not the technical specification, surely?

  10. 16

    Looking forward to the mud wrestling on this one. I am as confused as ever, and not from a lack of clarity or eloquence on the writer’s part!

    • 17

      Heydon Pickering

      January 18, 2013 7:49 am

      Mud wrestling? What about foxy boxing?

      On a serious note, I’d be delighted to try and field any questions about it here.

  11. 18

    Thank you. This is by far the clearest explanation I have read for the purpose of the section element. Perhaps the biggest reaction to it is from those who have never bothered with trying to make their webpages accessible in the past… why would they start now?

  12. 19

    The link to “ARIA landmark roles” in the first paragraph under the “ARIA ENHANCEMENT” header is broken.

    There is a space between the “-” and “roles” at the end of the link: roles/

    Other than that, a great read,

    Thanks :)

  13. 21

    Michel Balzer

    January 18, 2013 8:10 am

    Wow, thanks for explaining.

  14. 22

    Charlotte Koh

    January 18, 2013 8:26 am

    In the section of your article on ARIA enhancements, you wrote “Landmark roles, such as role=”navigation” and role=”banner”, address accessibility only — not data mining — and each may be used only once per document.”

    However, my understanding from the W3C Role Model is that certain landmark roles can be used more than once. While the banner role definition states “Within any document or application, the author SHOULD mark no more than one element with the banner role,” the navigation role definition mentions no similar limitations.

    Overall, I really enjoyed your article. Thanks for the read!

    • 23

      Heydon Pickering

      January 18, 2013 9:34 am

      You’re right, Charlotte. I meant to say role=”contentinfo” and have amended the article accordingly. You may have more than one navigation block.

  15. 24

    Nice article with lots of food for thought, thank you. I’m interested in sections and microdata within wordpress (combined with custom post-types and shortcodes) as reusable blocks of content. If we are future-proofing our sites, I think we should be boxing everything up neatly, so that articles can be sent to readers without taking the nav sections along with them, and so that contact cards and address sections can be sent to their own apps to parse without the article that was written.


  16. 26

    Great explanation about sections. Website authoring conventions are important, and more of our kind should take them more to heart.

  17. 27

    Cubicle Ninjas

    January 18, 2013 11:16 am

    Where has this article been all my career?

    Thank you for clearing up the questions I’ve been having since HTML5 became a thing. We will be referencing this heavily in all the sites we build in the future.

    • 28

      Heydon Pickering

      January 18, 2013 11:58 pm

      Glad to have helped, Ninja. Follow @heydonworks if you have any more questions.

  18. 29

    Heydon, do you know of any real site examples where these HTML5 elements are being done well? I saw your wordpress theme, but I’d love to see sites with lots of real data they organized . ..

    • 30

      Heydon Pickering

      January 19, 2013 12:13 am

      This very page incorporates some sectioning elements. Kudos, Smashing Magazine!

  19. 31

    You have written:

    Multiple-choice answers:
    a. 1
    b. 2
    c. 3
    d. 4
    The correct answer is (a), 2.
    a -> 1 ? Or 2?

    • 32

      Heydon Pickering

      January 18, 2013 11:56 pm

      Sorry for the confusion, Alessandro. The answer is (b), 2. The proof reader misunderstood the question and changed it to (a) 1 because they thought I was only counting sectioning elements, not sections, which implicitly includes <body> as I go on to point out.

      Not the proof reader’s fault – it was a trick question!

  20. 33

    Good article. One thing that I do find perplexing that I would love to hear your thoughts on, is the nav element. The nav element is defined as a section, and section elements sort of require a heading. Without an h tag you get an “untitled section” error. Typical usage of the nav element consists of an unordered list of links, and nothing more. An h tag or any labeling of the nav section doesn’t seem appropriate.

    • 34

      Heydon Pickering

      January 19, 2013 12:10 am

      My very long reply to Justin explains my position on untitled sections (I’m all for them in some circumstances).

      As for <nav>, I agree. The only reasonable case for deploying a heading in this case is for the benefit of screen reader users, which essentially make use of the heading as a label. For the same benefit you could use an actual label (via the aria-label attribute

      IMHO, headings for nav blocks are, like headings for footers, not a semantically good choice and only necessary for AT where aria-label="main navigation" would not be read.

      • 35

        “…like headings for footers, not a semantically good…”
        How would you markup the headings of lists, that are used in big footers?

        Example from
        div id=”footer”
        h4Best of Design/h4


↑ Back to top