The code used is:

<a href="%viewurl%?download=%title%"><div class="m">
<table><tr><td width="104px"><img class="thumb" src="%thumburl%" height="100px" width="100px" alt="%title%" /></td>
<td width="*">%title%<br/><font color="#000">Size: %filesize%<br/>Duration: %duration%<br/>Downloads: %downtotal%</font></td></tr></table>

Is it Ok to have HTML tags between <a href=""></a> as the anchor texts includes HTML codes would is harm SEO of the page?

  • Google uses a DOM model to parse HTML and content. Google can keep track of these things extremely well, however, I would keep an eye on it anyway. The reason why I say this is because code can be fickle sometimes. What I mean is that there may be conditions that are not covered purely by mistake. While what you are suggesting should not be a problem, I would advise just keeping an eye on it just in case. I will say this, Google has had plenty of time and examples so I am sure they can parse HTML extremely well even for pages that are not compliant or have errors. – closetnoc Sep 17 '15 at 15:17

It's completely OK to have HTML tags inside anchor tags when defining a clickable image in your webpage. The HTML code will be similar to the following:

<a href="http://example.com/path/to/link"><img src="someimage.jpg"></a>

My suggestion is to use only HTML tags that define output text or help define output text such as the IMG tag, and if you want to go old-school, you can even embed text in the FONT tag or even bold text. For example:

<a href="http://example.com/path/to/link"><b>Some text</b></a>

<a href="http://example.com/path/to/link"><font color="red"><b>Bolded red text</b></font></a>

But if you're aiming for SEO, the only tag I'd recommend inside anchor is the image tag (as shown in my first example) because the other two examples I showed are meant for an older version of HTML.

  • Should I understand from your answer that it would not be good SEO-wise to have more/other elements such as multiple DIV with text within the same anchor tag? – MrUpsidown Sep 22 '15 at 8:20
  • Yes. The only kinds of HTML tags I use within an anchor tag are comments, inline tags (such as the SPAN tag), and the IMG tag. – Mike -- No longer here Sep 22 '15 at 19:20
  • And we are talking about HTML5 right? – MrUpsidown Sep 23 '15 at 8:12
  • I'm still on about HTML4. I tried making sample HTML code with random tags in anchor tags and the w3c service doesn't seem to work properly at this time. The HTML5 checking on that site in the past was labelled "experiemental". – Mike -- No longer here Sep 23 '15 at 19:19

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.