The HTML Section Element Is Useless
Web developers use the HTML section element to represent a generic section of a document. Although the section element is used by many developers who claim to care about web accessibility, I argue that the section element can not be used in any context and should be deprecated as soon as possible.
Evaluating what the specification says
Let us first understand what the intention for the existence of the section element is:
The
<section>HTML element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it.
According to MDN, it is used to represent a section of a document. But it is only for a generic one, and we use it when we do not have any other semantic element to represent that section.
Let me ask you: what is a generic section in a document that can only be represented by the section?
Moreover, why does a generic section need to be labelled as generic anyway? A generic section does not need a label because the following markup is a generic section, since the h2 already divides content in a document into a generic section:
<h2>How to play GTA VI today on your PC?</h2>
<!-- Some sketchy content -->
<h2>How to get GTA VI for free?</h2>
<!-- Some sketchy content -->
The MDN documentation shows us some examples of using the section element. But none of those examples satisfy the need to use it because
- the
divelement wrapping anh2element and apelement is good and generic enough; and - the
sectionelement that either wraps a group of links or a group of buttons can be replaced with thedivelement or other elements, such as thenav.
But MDN is not the primary source.
We need to see the primary source, which is the official HTML specification page. It says the following about the section element:
The section element represents a generic section of a document or application.
But after that, it says the following:
The section element is not a generic container element.
A few lines before, the specification said that it is a generic section of a document. Now it says that it is not a generic container.
Okay.
This means a generic container element and a generic section are two different things.
The question we should all ask is simple: what are the differences between a generic container element and a generic section? Nobody knows the answer.
Do you know why nobody knows the answer? Nobody knows because a generic container element and a generic section are the same thing. Very simple!
Additionally, isn't that the div element already taking the role of representing a generic section element? It has no semantic meaning. This means it will not do anything funny that can mess up the accessibility of a document.
When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the
divelement instead.
Do you understand the meaning of the above quotation? It means the section element should not be used only for styling purposes. We should not use it for scripting. Use the div element instead. That is wonderful.
But if the section element is not only for styling purposes when its role is a generic section, what should it be used for? Nobody knows the answer.
I am just getting started here. Yet we can not find a concrete reason to use the section element, and the specification just confuses us with the idea that a generic container element is not the same as a generic section when both are, in fact, generic and have no semantic meaning at all.
Assessing what experts say
I do not want to consult an artificial intelligence because it is stupid when it comes to debate. I always end up making it apologize while it also keeps forcing its stupidity to my face.
But we have experts. We can understand the most current discussion about the section element and how and when we should use it.
Olushuyi fails to see the actual problem
Olushuyi Olutimilehin teaches us how to use the section and the article correctly. But the problem is that he assumes that both elements are legitimate elements in the first place. I believe both elements are useless. But for this article, I keep focusing on the section element only.
Guess what? I noticed confusion from Olushuyi when he says the following after he quoted the specification for both the section and the article:
However, it is safe to say that the choice is seemingly heavily subjective.
The problem is not about subjectivity. It is about the clarity of the document. It is not clear at all.
The irony of the specification for the section element is that it barely specifies what the element is actually meant to do. The developers are left guessing when to use it and how it differs from the div element.
He mentions that the spec says that the section element can be used to wrap chapters. But I argue that is false and is totally nonsense because we should use only the heading elements instead of the section element.
Remember what the specification says about the section element: it is a generic section. It has no semantic role to divide content within a page into meaningful sections. But the heading elements have that semantic role already.
To make each chapter a standalone chapter within a document, we use the heading elements. We do not use the section element.
Even if we use the section element with the heading elements, we gain nothing because the heading elements have done their job well at grouping each chapter. The section should be replaced with the div element because its sole purpose will be for styling.
Bruce notices one use case for the section element
Bruce Lawson argues that the article element is preferable over the section element because the document outline algorithm is not supported by any browsers. I agree with his arguments.
He then mentions that the section element has its place in Smashing Magazine's article structure: the quick summary.
<section aria-label="quick summary">
Summary text
</section>
The problem with that code snippet is that using the aria-label attribute means the label is not visually visible. But I understand that Smashing Magazine has a visible label that uses the CSS pseudo-element. Using the CSS pseudo-element to show some text content means it is not available in the accessibility tree of the document. So, with a CSS pseudo-element as a visible label and the aria-label for the accessible name, all users are covered, right?
I do not think so because users' devices are so diverse, and I have a better solution:
<div>
<h2 class="vh">Quick summary</h2>
<p>Summary text</p>
</div>
That solution is better because it uses the heading element, which means the quick summary is visible both in the document outline and the heading list in assistive technologies. The vh class is a visually hidden styling for developers to hide it visually while still making it visible to the browser and assistive technology. Smashing Magazine can still use the CSS pseudo-element approach to show the visible "Quick summary" text.
Even better, they can just style the h2 and remove the pseudo-element. This means there is no invisible element and no duplication for the "Quick summary" text.
Scott's statements create more questions
Right at the very beginning, Scott O'Hara mentions a new definition for the section element:
The
<section>element semantically represents a generic grouping of content with an overarching theme.
I wonder where Scott got the idea of "a generic grouping of content with an overarching theme."
As far as what is programmatically exposed to assistive technologies (AT), there is no discernible difference between the
<section>and<div>that contain their respective<h2>elements.
I do not think we can find any differences at all. Some assistive technologies may treat the section element as something. But it is not useful to highlight a section when a heading element is already there.
The
<section>does not presently behave the way it is defined in the HTML specification.
The HTML specification for the section element is ignored by all browser vendors. Looks like the HTML Living Standard is not fully living up to its standard. Too bad!
We know that the section element is a generic section. The div element is also a generic container element. Both are generic elements. I wonder how Scott can write the following statement:
And its use can help other developers more quickly understand the structure of a web page, rather than having to rely on a bunch of
<div>s and classes to hopefully understand the intended structure.
I have to disagree with Scott's statement here because I have never heard someone say that because another developer uses the section elements, they feel grateful because they can understand the structure of the web page much faster than a document that uses the div elements with classes.
If developers understand the structure of a document more quickly because of the use of the section elements, the question we should ask is, "How much more quickly do those developers understand a document with the section elements than those without them?"
If the result is significant, what makes the section better than the div with classes? I really want to know because I do not see any difference in understanding the following structure:
<div class="hero">
<div class="container">
<h1>Section is useless</h1>
</div>
</div>
<!-- Which one is easier to understand? -->
<section class="hero">
<div class="container">
<h1>Section is useless</h1>
</div>
</section>
When developers use the section element, they will use the class attribute anyway to identify the section. The same goes when they use the div element. I do not see any difference. Even if the document structure is a lot more complex than the code snippet, replacing all the section elements with the div elements is not going to make the document structure significantly harder or easier to understand.
Chris even gets confused
Chris Coyier's article tells us how confusing the section element is because it does not work as expected, and nobody can make a straightforward and clear point because it is confusing.
But
<section>is more nebulous.
Correcting common misunderstandings
Many naive web developers think that the section element is a semantic element. In fact, it is not a semantic element. It is a generic standalone section, as the specification states. Generic elements are not semantic elements because they have no special meaning attached to them in the document accessibility tree.
WebAIM is being politically correct
WebAIM is the only one that realizes that the section is useless, as far as I know. Although it still mentions the following politically correct statements, I agree that even with the aria-label attribute, it is rarely useful if it is ever becoming useful.
<section>and<article>can be useful to contain blocks of content. They do not function as regions unless they are given an ARIA label, but this is rarely useful.
Notice that WebAIM uses the word "can" instead of "is" in addressing the usefulness of the section element. This means that, according to WebAIM, the section is possibly useful if it is ever useful.
WebAIM on another page mentions the following:
These have no useful semantics unless given an ARIA label (which is not typically recommended).
If I were one of the authors at WebAIM, I would write that the section element has no useful meaning at all and that using an ARIA label can be a sign for you to find a better solution.
Developers on Stack Overflow and Reddit are confused
Developers from 15 years ago asked at Stack Overflow.
How to correctly use "section" tag in HTML5?
But until 2026, nobody is sure how to use it correctly.
The most upvoted answer does not even bother to explain what the specification states. But it states the true fact about the div element:
Note that
<div>, being completely non-semantic, can be used anywhere in the document that the HTML spec allows it, but is not necessary.
See? The most upvoted answer from Stack Overflow even says that the div element is better because it can be used anywhere, and that is true.
As a side note, developers understand the div element better than the section element.
We all can use the div element anywhere inside the body element and there is no requirement where we need to use the HTML heading elements or to label it with an ARIA attribute. This means
- the
divelement is very useful and is very easy to understand; and - the
sectionelement is not generic, but it is generic anyway and requires us to use a heading element or label it with an ARIA attribute when, in fact, a heading element is enough, and we do not need to use thesectionelement.
Developers on Reddit has no answer at all to the following question:
What is the purpose of
<section>?
Nobody knows the answer because it has no purpose in the first place. They only ask the poor developer, u/ThePupkinFailure, to read the specification, which gives a confusing and contradictory answer.
Even doctors can not help the section element
The so-called doctors for HTML had a revelation that developers were using the section element incorrectly.
Apart from spurious requests for medical advice, the questions we receive most are about using the section element, and we realise that we’ve been using the section element incorrectly all this time.
The funny thing from Bruce Lawson and Dr. Steve, the authors of HTML5 Doctor, is that they have made the section element practically non-usable in all situations because they say
- if you want to only style a section of a page, use the
divelement; and - that you should use the
article,aside, ornavinstead because they are more appropriate—which generates a practical question: if we already use thesectionelement, isn't that thedivelement more appropriate and has less unintended web accessibility impact?; and - that you use it with a heading element inside it—but as we already know that the heading element is sufficient without the
sectionelement; and - the specification's update at that time encourages the use of the
articleelement anyway.
Replacing the section element
When do we use the section element then? Never.
What if I want to have a generic section to appear in the document outline?
First of all, why do we want to have a generic section to appear in the document outline? That is the job of the heading elements: to divide content in a document into generic sections. We do not need another element to label those so-called generic sections.
But because developers love demanding strange and stupid solutions for problems that do not need to exist, they can use the div element with the aria-label or aria-labelledby attribute.
<div role="region" aria-label="I want to be more visible">
<!-- region content -->
</div>
<div role="region" aria-labelledby="more-visible">
<h2 id="more-visible">I want to be more visible</h2>
<!-- region content -->
</div>
Again, why do we need to write that complicated HTML markup when we can just write the following?
<h2>I want to be more visible</h2>
<!-- region content -->
Challenging all who oppose
I challenge you to give me one—just one—where the section element is a must and is the only choice. You may find one. But I give you a better and more robust solution with less code and, for sure, without the section element.
By the way, the hgroup element is also useless.
Thank you for reading this The HTML Section Element Is Useless. You can subscribe to all my articles with the Articles RSS. Add this website as a preferred source on Google. If you have a positive or negative comment, please send me an email or contact me through one of my social media accounts.
Share with your network
Copy this link and send it to great people only.
https://vanzasetia.xyz/blog/section-is-useless/
For you
Why Do Web Developers Write Code in an Editor Instead of Directly in a Browser?
Have you ever thought about such a question? I never did until I saw that question on Stack Overflow. Here are my reasons to use a code editor instead of a browser to write code.
By Vanza Setia
Vampire Generation Dominates the World
Help me! There are vampires around me. They hate lights.
By Vanza Setia