Possible Duplicate:
Is putting a div inside an anchor ever correct?
When we write some kind of 'product list', you need only one link, but it should contain product image, product name, product title etc. can we use a contain p or some other tag? is there any cross browser issue?
I heard in html5, a tag can contain p tag, but still with no confidence about using it.
some code like so:
<ul class="xxx_list">
<li class="hproduct">
<a href="#" class="url" title="" target="_blank">
<img class="photo" src="shoujike.jpg" alt="手机壳">
<p>
<span class="price_wrap">¥<span class="price">88.00</span</span>
<span class="fav">收藏</span>
</p>
<p><a class="fn" href="">基本商品单元的商品名称</a></p>
</a>
</li>
</ul>
In HTML 4.x (and earlier) and XHTML 1.x — No. <a>
elements may not contain <p>
elements.
In HTML 5 — <a>
elements may contain <p>
elements, but browsers are a bit flaky about it and you may find you have to explicitly set the <a>
to display: block
in your stylesheet.
The code in the question also includes an <a>
inside that <p>
. This is not allowed. An <a>
element may not be a descendant of another <a>
element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With