Ad

Wrapping A H2 Tag Inside Another H2 Tag?

- 1 answer

Is it bad practice in terms of SEO to wrap a H2 tag inside another H2 tag like so or is this still a valid method of displaying h2 tags :

<div class="content-caption light-content">
    <h2 class="open-project-link">
        <a class="open-project" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="work01.html">
            <h2 class="section-info">Branding</h2>
        </a>
    </h2>
</div>

Or will you be disciplined by google and will your SEO take a hit?

Ad

Answer

It is impossible to nest H2 elements. The HTML specification forbids it. Error recovery will either give you sequential headings or ignore one entirely (triggering it is foolishing though).

Content model: Phrasing content.

Phrasing content does not include headings.

It doesn't make sense to try to do so in the first place though.

Ad
source: stackoverflow.com
Ad