为了账号安全,请及时绑定邮箱和手机立即绑定

描述详细信息元素中是否允许使用无序列表元素?

描述详细信息元素中是否允许使用无序列表元素?

达令说 2023-10-16 10:31:45
一个dd元素可以包含一个ul元素吗?像这样:<dl>  <dt>Lorem</dt>  <dd>Sed lectus</dd>  <dt>Vestibulum</dt>  <dd>    <ul>      <li>viverra nec</li>      <li>blandit vel</li>      <li>egestas et</li>    </ul>  </dd>  <dt>Suspendisse</dt>  <dd>Nulla quam</dd></dl>
查看完整描述

1 回答

?
蝴蝶不菲

TA贡献1810条经验 获得超4个赞

<dd>是的,a包含 a是有效的<ul>。根据HTML 规范,<dd>元素应该包含流内容。无序列表被视为流内容。

但是,如果示例中的每个项目都是前面术语的替代描述<dt>则不应将它们标记在无序列表中,而应使用一系列<dd>元素进行标记。

例如,以下内容是有效的 HTML,但在语义上不正确- 因为它意味着整个列表是该术语的单一描述。

<dl>

  <dt>Firefox</dt>

  <dd>

    <ul>

      <li>A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</li>

      <li>The Red Panda also known as the Lesser Panda, Wah, Bear Cat or Firefox, is a mostly herbivorous mammal, slightly larger than a domestic cat (60 cm long).</li>

    </ul>

  </dd>

</dl>

标记此内容的有效且语义正确的方法是:


<dl>

  <dt>Firefox</dt>

  <dd>A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.</dd>

  <dd>The Red Panda also known as the Lesser Panda, Wah, Bear Cat or Firefox, is a mostly herbivorous mammal, slightly larger than a domestic cat (60 cm long).</dd>

</dl>


查看完整回答
反对 回复 2023-10-16
  • 1 回答
  • 0 关注
  • 47 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信