[英]Getting an error in W3C Markup Validation when trying to get a whole <Figure> element as a link in a page
I am trying to get whole <figure>
element as a link so i wrote these line of code :- 我试图获取整个
<figure>
元素作为链接,所以我写了以下代码行:-
<figure>
<a href="#">
<img src="images/product-image.jpg" alt="image " />
<span class="label"><span class="rotate">40%</span></span>
<span class="curle-label_bg"></span>
<figcaption><span class="product-brand">Brand of product</span>
Main Caption here
<span class="save-money">Save 395.05</span>
<span class="product-price">€169.30</span>
</figcaption>
</a>
</figure>
I am getting an error "Element figcaption not allowed as child of element a in this context. (Suppressing further errors from this subtree.)" in http://validator.w3.org/ ,I have changed my Document Type in to HTML5 (experimental) in "More option" , Can anybody tell me why i am getting this error or where i am going wrong? 我得到一个错误“元素figcaption不允许作为在这方面元素的的孩子。(从这个子树抑制进一步的错误。)”在http://validator.w3.org/ ,我已经改变了我的文件类型中HTML5 (实验性)在“更多选项”中 ,有人可以告诉我为什么我遇到此错误或我要去哪里吗?
Better to do this: 最好这样做:
<a href="#">
<figure>
<img src="images/product-image.jpg" alt="image " />
<span class="label"><span class="rotate">40%</span></span>
<span class="curle-label_bg"></span>
<figcaption><span class="product-brand">Brand of product</span>
Main Caption here
<span class="save-money">Save 395.05</span>
<span class="product-price">€169.30</span>
</figcaption>
</figure>
</a>
Now the figure is enclosed within the a tag, and the figcaption is a child of the figure, not the <a>
现在该图形被包含在一个标签中,figcaption是该图形的子级,而不是
<a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.