如何标记 HTML 列表的标题
AFAIK,没有专用的元素(例如用于表格的 、用于图形的
等)来标记列表的标题。我应该使用什么标记?在 HTML 3.0 中,有一个元素
但现在已弃用。
Lorem ipsum dolor sat amet, consectetur adipiscing elit。努拉 eget enim nec metus feugiat porta。 悬而未决的判决 没什么。前庭 福西布斯·奥西·卢图斯等的原发 ultrices posuere cubilia Curae;莫尔比 nisl suscipit rutrum 中的简历。
我喜欢的水果:
凤梨
覆盆子
香蕉
在莫里斯·维尔·迪亚姆·埃莱芬德中 脂肪。 Proin id neque quam,欧盟 马蒂斯·伊普苏姆。 Nulla facilisi。 Sed ID 智人 eget mi cursus placerat vel sed 胡斯托。整数 vel pellentesque magna。 Donec quis nisi lacus, Accumsan 雄狮。奎斯克临时梅图斯 生命 nisl eleifend aliquet。保护者 adipiscing purus magna。
AFAIK, there is no dedicated element--like <caption>
for tables, <figcaption>
for figures, etc.--to mark the header of a list. What markup should I use?
In HTML 3.0, there was an element <LH>
but it is deprecated now.
Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Nulla
eget enim nec metus feugiat porta.
Suspendisse convallis dictum
tincidunt. Vestibulum ante ipsum
primis in faucibus orci luctus et
ultrices posuere cubilia Curae; Morbi
vitae erat in nisl suscipit rutrum.Fruits I love:
Ananas
Raspberry
Banana
In in mauris vel diam eleifend
adipiscing. Proin id neque quam, eu
mattis ipsum. Nulla facilisi. Sed id
sapien eget mi cursus placerat vel sed
justo. Integer vel pellentesque magna.
Donec quis nisi lacus, accumsan
rhoncus leo. Quisque tempor metus
vitae nisl eleifend aliquet. Maecenas
adipiscing purus magna.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看来您需要 HTML5 答案。如果您的所有列表都有标题,我将使用
(现在的意思是 description 列表)和单个
标题,并且列表项为
如果您混合使用大量带/不带标题的列表,我会坚持使用
/
< ol>
并使用普通的
。将
和列表包装在中以保留语义:
It looks like you want a HTML5 answer. If all your lists have header I would use a
<dl>
(now meaning description list) with a single<dt>
header and the list items as<dd>
's:If you mix a lot of lists with/without headers I would stick with
<ul>
/<ol>
and use normal<hX>
's. Wrap the<hX>
and the list in a<div>
to preserve the semantics:我会使用常规标头,最好是低于您之前使用的标头的级别。
I'd use a regular header, preferably in the level below your previously used one.
在这种情况下,没有理由使用除段落之外的任何其他内容。
figcaption
在另一种情况下是合适的:There's no reason to use anything else than a paragraph in this case.
figcaption
would be appropriate in another circumstance:您可以执行以下操作:
我会使用标题,这对于导航和标记页面的一般语义结构非常有用:
我喜欢的东西
列表
凤梨
覆盆子
香蕉
详细说明
Lorem ipsum…
(抱歉对于这种格式)
如果您使用 Firefox,我建议使用 HeadingsMap 来清楚地查看页面结构:
HeadingsMap :: Firefox 附加组件
There are few things you can do:
I'd use the headings, which are very good for navigation and marking general semantic structure of the page:
<h3>Things I love</h3>
<h4>The list</h4>
<ul>
<li>Ananas</li>
<li>Raspberry</li>
<li>Banana</li>
</ul>
<h4>Elaborated description</h4>
<p>Lorem ipsum…</p>
(Sorry for this formatting)
If you use Firefox, I'd recommend HeadingsMap to clearly see the page structure:
HeadingsMap :: Add-ons for Firefox