如何在语义上为HTML中的列表提供标题,标题或标签 [英] How to semantically provide a caption, title or label for a list in HTML

查看:66
本文介绍了如何在语义上为HTML中的列表提供标题,标题或标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为HTML列表提供语义标题的正确方法是什么?例如,以下列表具有标题"/标题".

What is the proper way to provide a semantic caption for an HTML list? For example, the following list has a "title"/"caption".

水果

  • 苹果
  • 橙色

应该如何处理水果"一词,使其在语义上与列表本身相关联?

How should the word "fruit" be handled, in a such way that it is semantically associated with the list itself?

推荐答案

虽然没有标题或标题元素可以有效地构造您的标记,但效果相同.这里有一些建议:

While there is no caption or heading element structuring your markup effectively can have the same effect. Here are some suggestions:

嵌套列表

<ul>
    <li>
        Fruit
        <ul>
            <li>Apple</li>
            <li>Pear</li>
            <li>Organge</li>
        </ul>
    </li>
</ul>


列表前的标题

<hX>Fruit</hX>
<ul>
    <li>Apple</li>
    <li>Pear</li>
    <li>Orange</li>
</ul>


定义列表

<dl>
  <dt>Fruit</dt>
  <dd>Apple</dd>
  <dd>Pear</dd>
  <dd>Orange</dd>
</dl>

这篇关于如何在语义上为HTML中的列表提供标题,标题或标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆