w3c html validation error - Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections

给你一囗甜甜゛ 提交于 2019-11-27 04:44:45

Either:

  1. Add a heading (h1, ..., h6) tag to your section element.
  2. Replace your section element with a div element.
  3. Ignore the warning. The message you're seeing is a non-normative usage recommendation, as per the HTML5 spec (highlighting mine):

    The theme of each section should be identified, typically by including a heading (h1-h6 element) as a child of the section element.

unor

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).

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>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!