2

I'm making a new layout for our website, and I want to make a list using the unordered list tag (ul) to show our offers. But because of our design I would like to use the h3 tag into an a element.

How would my idea impact SEO?

Here's an example in code of what I'm trying to achieve:

<a><h3>Header</h3><p>Text</p></a>

I believe the following HTML (which contains my idea) is valid, but how would it affect SEO?

<!DOCTYPE html>
<html>
    <head><title>Test</title>
    <body>
        <a>
            <h3>Header</h3>
            <p>Text</p>
        </a>
    </body>
</html>
  • 2
    That's not valid HTML – John Conde Jun 29 '16 at 14:15
  • Do you have a h1 tag as well? – illinoistim Jun 29 '16 at 14:59
  • @illinoistimYes I have one h1 – bumerang Jun 30 '16 at 6:41
  • 1
    @John Conde according to this validator validator.w3.org/nu/#textarea (just put my HTML) it is valid – bumerang Jun 30 '16 at 6:43
  • What does such an a element contain exactly? The heading for the offer name and a short description? Or more/longer content? Would each offer be in a li element which contains nothing else? – unor Jun 30 '16 at 13:45
4

The rules are simple regarding to this:

You are not allowed to wrap an inline element around a block element.
The exception: If you use HTML5, you may wrap in anchor around a block element.

From a SEO perspective it doesn't have influence, it's valid html so they wont discredit for that.

It doesn't help either. You're ramming a whole paragraph into an anchor, making the value of each word in it very very small, and you also stuff it with words your don't care about ("This is an example" » only keyword is 'example', yet the whole sentence is the anchor).

From User Interface point of view, it can (depends on the implementation) be very odd, the whole paragraph is a link? "Huh, I just clicked plain text and now I've changed page?!".

  • Good answer. I've done things like this when linking title & excerpt cards to blog posts. But, yeah, probably not a wise SEO strategy if that's the only reason you're doing it. – Nathan GoFundMonica Arthur Jul 7 '16 at 22:08
0

Wrapping an anchor around blocks is acceptable in HTML5, not in previous versions like HTML 4/XHTML.

In HTML5 we have:

The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).

-> https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element

e.g.:

<aside class="advertising">
 <h1>Advertising</h1>
 <a href="http://ad.example.com/?adid=1929&amp;pubid=1422">
  <section>
   <h1>Mellblomatic 9000!</h1>
   <p>Turn all your widgets into mellbloms!</p>
   <p>Only $9.99 plus shipping and handling.</p>
  </section>
 </a>
 <a href="http://ad.example.com/?adid=375&amp;pubid=1422">
  <section>
   <h1>The Mellblom Browser</h1>
   <p>Web browsing at the speed of light.</p>
   <p>No other browser goes faster!</p>
  </section>
 </a>
</aside>

So yes, it is valid HTML and safe to use it if you use HTML5, it won't be safe if you want to make it compatible with other versions of HTML.

Update Is this SEO valid?

This is just like asking if using an HTML tag is valid for SEO, they are not valid per se, but what makes them SEO valid is the context where they are used.

If it was not valid HTML then it won't be appropriate for SEO, but being valid HTML doesn't makes it SEO valid, it will depend how you use it to structure your content.

  • 1
    Thanks for your reply, I do now it is valid, but I want to know more about SEO impact is it good practise to put <h*> in <a> or rather vice versa – bumerang Jun 30 '16 at 6:47
  • @bumerang I've updated the answer. – marcanuy Jun 30 '16 at 13:52
0

Good SEO comes from good page content. Good SEO also comes from correct markup. Naturally as HTML5 is a total mess of non-clear markup rules I would stick to Xhtml versions if you do not need canvas commands. Anyhow I would not play tricks. I would get great page content and proper markup and make lots of pages and get good results. Google feels the love you put into your work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.