放置< h2>在语义上是否不正确?< li>之间的标签标签? [英] Is it semantically incorrect to place <h2> tags between <li> tags?
本文介绍了放置< h2>在语义上是否不正确?< li>之间的标签标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打算做这样的事情:
<ul class="menu">
<li><h2>Contact</h2></li>
<li>my email</li>
<li>my phone</li>
</ul>
从语义上讲是不正确的(还是不好的作法?)
Is it semantically incorrect (or a bad practice?)
如果答案是肯定的,我应该这样做吗?
If the answer is yes, should I do this instead?
<ul class="menu">
<li><strong>Contact</strong></li>
<li>my email</li>
<li>my phone</li>
</ul>
(我不能仅放置一个标题标签,因为没有用于对其进行分组的div):
(I can't place just a heading tag, since there are not divs to group them):
<div id="branding">
<h1>
<ul class="menu">
<ul class="menu">
<ul class="menu serif">
<ul id="lang">
</div>
推荐答案
是否存在将联系人"放入 li
内的特定原因?看来这是列表的标题,而不是列表的一部分,所以我会这样做:
Is there a particular reason to put "Contact" inside a li
? It seems like it's a header to the list rather than a part of the list, so I'd do:
<h2>Contact</h2>
<ul>
<li>my email</li>
<li>my phone</li>
</ul>
这篇关于放置< h2>在语义上是否不正确?< li>之间的标签标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文