Reputation: 2034
I am getting a warning when I try to validate my page in https://validator.w3.org:
Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections.
My code is as below:
<section id="slider-wrapper-new">
<div class="slider-container-new">
// some code..
</div>
</section>
How can I remove this error? Do I need to add h1
-h6
tags inside the section heading?
Upvotes: 44
Views: 72621
Reputation: 129
You have to put an h1,h2,h3 inside your section:
<section id="slider-wrapper-new">
<div class="slider-container-new">
<h3>My Title</h3>
// some code..
</div>
Upvotes: 2
Reputation: 97150
Either:
h1
, ..., h6
) tag to your section
element.section
element with a div
element.The theme of each
section
should be identified, typically by including a heading (h1
-h6
element) as a child of thesection
element.
Upvotes: 49
Reputation: 96587
Your code is valid (if you use a closing </section>
instead of </div>
).
The W3C validator reports a warning, not an error.
While it is useful to provide a heading for each sectioning content element, it is not required.
The only way to prevent this warning when using sectioning content elements is, well, to follow the advice by providing a heading content element. If you’d use a div
instead, your document outline would be different and likely wrong (if you used section
correctly in the first place).
Upvotes: 17