本文介绍了如何在语义上将标题添加到列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这一直困扰着我,我想知道如何正确地做到这一点,是否有共识。当我使用HTML列表时,如何在语义上为列表添加标题?
其中一个选项是:
< h3>我喜欢的水果:< / h3> < ul> < li>苹果< / li> < li>香蕉< / li> < li>桔子< / li> < / ul>但在语义上< h3> 标题与< ul>
没有明确关联。另一个选项是这样的:
< ul> < li>< h3>我喜欢的水果:< / h3>< / li> < li>苹果< / li> < li>香蕉< / li> < li>桔子< / li> < / ul>但这看起来有点肮脏,因为标题并不是真正的列表项之一。 p>
W3C不允许使用此选项:
< UL> < h3>我喜欢的水果:< / h3> < li>苹果< / li> < li>香蕉< / li> < li>桔子< / li> < / ul>为< ul> 的可以只包含一个或多个< li> 的
旧的列表标题< lh> 最有意义
$ b < ul> ; < lh>我喜欢的水果:< / lh> < li>苹果< / li> < li>香蕉< / li> < li>桔子< / li> < / ul>但它当然不是HTML的正式部分
我听说它建议我们像
更多推荐
如何在语义上将标题添加到列表中
发布评论