2

I have <article>, <section>, <header> and everything seems fine, but the HTML Validator returns error:

Warning: Article lacks heading. Consider using h2-h6 elements to add identifying headings to all articles.

Can you please advise me where is the problem?

<div class="item column-1" itemprop="blogPost" itemscope="" itemtype="http://schema.org/BlogPosting">
  <article>
    <section class="article-intro clearfix" itemprop="articleBody">
      <header>
        <h2>My header text</h2>
      </header>
      <p>My paragraph text</p>

      <p>
        <img src="/images/myimage.jpg" alt="image alt">
      </p>

    </section>
  </article>
</div>
j08691
  • 204,283
  • 31
  • 260
  • 272
Bocho Todorov
  • 429
  • 1
  • 9
  • 22
  • Possible duplicate of [w3c html validation error - Section lacks heading. Consider using h2-h6 elements to add identifying headings to all sections](https://stackoverflow.com/questions/24155024/w3c-html-validation-error-section-lacks-heading-consider-using-h2-h6-elements) – G_real Jul 03 '19 at 21:17

2 Answers2

4

What the validator is complaining about is the lack of headings in your article blocks. As in, your article, not the nested sections. The optimum structure would be something like:

<article>
  <h1>Some heading</h1>
  <p>Content of the article ... </p>
</article>

You're not doing anything wrong by the way, keep in mind that it's just a warning, not an error.

P.S well done for trying to follow the W3C standards, btw

Marwan Alani
  • 286
  • 1
  • 6
  • Thank you! Unfortunately I am using Joomla and I cannot change the html exactly as I want. This is the closest what I could get, but still not Valid

    – Bocho Todorov Mar 10 '16 at 20:00
3

Use aria-label="article"

<article aria-label="article">
  <p>Content of the article ... </p>
</article>