Search code examples
htmlw3c-validation

W3C validation says h1 in article is invalid


I'm running my website through the W3C validation service. I'm getting an error message for the following HTML:

<section class="about">
  <article>
    <header>
    <h1>Mission</h1>
    </header>
    <div class="content">
      <p>bla bla bla</p>
    </div>
    <aside>
      <img src='/images/logo-hse-250x250.png' />
    </aside>
  </article>
</section>

The W3C validation error is:

Consider using the h1 element as a top-level heading only (all h1 elements are treated as top-level headings by many screen readers and other tools).

<h1>Mission</h1>

I thought with HTML5, it was allowed to use more than one h1 tag on a page. And that h1 tags could be used inside article elements.

Does anyone have a clue why W3C isn't validating this HTML?


Solution

  • It is valid to use h1 there.

    The W3C Markup Validator does report a warning, not an error. You can ignore warnings if you like to.

    The HTML5 spec "encourages" authors to use "headings of the appropriate rank" instead of h1 everywhere. But an encouragement is not a normative requirement.