Reputation: 3324
My doctype is html5. I am validating this HTML:
<a class="article-link-block" href="http://localhost/article/231">
<img src="http://localhost/images/article-image.jpg">
<div class="article-info">
<a class="title" href="http://localhost/article/231">Title of the article</a>
<a class="category" href="http://localhost/category/5">Category</a>
<div class="views">24x</div>
<div class="date">13.3.2013</div>
</div>
</a>
I am getting this error:
Error: An a start tag seen but an element of the same type was already open.
I want the whole div
to be an anchor tag ( article-link-block ) and within it another anchor tags to category, user etc. and other divs (the code above is simplified to only article and category link.)
How can I get rid of this error during html validation?
Upvotes: 0
Views: 4758
Reputation: 75707
If you want it all to validate you're going to have to choose whether you want the block level link, or the child links. You can't have both. From the spec:
Content model: Transparent, but there must be no interactive content descendant.
a
audio
(if thecontrols
attribute is present)button
details
embed
iframe
img
(if theusemap
attribute is present)input
(if thetype
attribute is not in the Hidden state)keygen
label
object
(if theusemap
attribute is present)select
textarea
video
(if thecontrols
attribute is present)
So your options are:
click
eventsUpvotes: 2