<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>
我看过这段代码,我已经过验证,它在 w3c HTML5 验证中返回 VALID。
我很难在 anchor
中使用 h3
。
如果我们 display:block;
anchor ,这似乎变得有效?
最佳答案
如果您查看 HTML5 spec , 在 <a>
上有一节标签:
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).
我在 HTML4 spec 中找不到任何内容那是说将 block 级标签放在行内级标签内是无效的,但我确实记得在某处读过它。
关于html - 将 h3 嵌套在 anchor 中 - 这如何有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12659766/