问题
I have a list of articles (ul). I want each "ul" list element clickable (100 % width) as an anchor.
What is better approach (according to SEO and Google bots)?
1) HTML5 allows to put <div>
inside <a>
, so my code is valid (I have checked it in html5 validators). Also i.e. apple.com website have the same approach (h1- block element - inside of anchor).
<ul>
<li><a href="#"><div>Category</div><div>Title</div><div>Popularity</div></a></li>
...
</ul>
2) I can also set li position as relative, and then have only "title" as link, but this anchor will have "position: absolute;" and proper padding to fill the whole 100% height and 100% width of li. In that case, whole li element is clickable, but these approach seems to be inelegant (in css), but also it's valid with html 4.01 and xHTML
<ul>
<li><div>Category</div><a href="#">Title</a><div>Popularity</div></a></li>
...
</ul>
回答1:
What is your concern? Whether the link itself will be picked up or the anchor text used?
Google will definitely pick up the link itself so there are no issues there.
It may however get confused over what anchor text you are linking with (and subsequently the intent/semantics of the link). You could probably help it by using a title
tag on the anchor.
I expect it would see the anchor text as "Category Title Popularity". This by itself is a nonsensical so I am assuming this is not an issue to you but I would, as you are concerned with SEO, add a relevant title to your link.
来源:https://stackoverflow.com/questions/6484795/div-within-a-seo-optimization