将h3嵌入锚内 - 这是否有效? [英] Nesting h3 inside anchor - how is this valid?
问题描述
< li class =vcard>
< a class =urlhref =/ about / us />
< img class =photoalt =somesrc =/ img / nicething.png>
< h3> hello< / h3>
< / a>
< p class =role meta>有些东西在这里< / p>
< / li>
我已经看过这段代码,我已经验证过,它会在W3C HTML5验证中返回VALID。 / p>
我很难在锚内找到
h3
$ c $如果我们 display:block;
锚点?
如果您查看 HTML5规范,< a>
标签中有一节:
a 元素可以包裹整个段落,列表,表格等等,甚至整个只要没有交互式内容(例如按钮或其他链接)。
我找不到任何内容 HTML4规范,它表示将块级inli内部的标签ne-level标签是无效的,但我确实记得在某处阅读它。
<li class="vcard">
<a class="url" href="/about/us/">
<img class="photo" alt="some" src="/img/nicething.png">
<h3>hello</h3>
</a>
<p class="role meta">Something here</p>
</li>
I've seen this code, I've validated and it returns VALID on w3c HTML5 validation.
I tough that we couldn't have h3
inside an anchor
.
It seems that this became valid if we display:block;
the anchor ?
If you look at the HTML5 spec, there is a section on the <a>
tag:
The
a
element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).
I can't find anything in the HTML4 spec that says that putting block-level tags inside of inline-level tags is invalid, but I do remember reading it somewhere.
这篇关于将h3嵌入锚内 - 这是否有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!