gpt4 book ai didi

html - 将定义列表与有序列表结合的正确方法是什么?

转载 作者:行者123 更新时间:2023-12-01 11:24:36 28 4
gpt4 key购买 nike

我想制作一个有序的定义列表。我应该嵌套一个 <ol><dl> ,或者反过来?

IE。

<h4>Bike Descriptions</h4>
<dl>
<ol>
<li>
<dt>Giant Bikes</dt>
<dd>Bikes that are very sturdy and reliable.</dd>
</li>
<li>
<dt>Walmart Bikes</dt>
<dd>Bikes that are crummy and heavy.</dd>
</li>
</ol>
</dl>

<dl><ol>甚至在每个 <li> 内?

The docs don't seem to say.

最佳答案

根据 that documentation ,唯一的元素 a <dl>可能包含 <dt><dd> :

Content model:

Zero or more groups each consisting of one or more dt elements followed by one or more dd elements, optionally intermixed with script-supporting elements.



因此,您的示例代码是无效的 HTML。唯一有效的嵌套方式 dlol/ ul正在订购 ol/ ul > li > dl > dt + dd :

<h4>Bike Descriptions</h4>    
<ol>
<li>
<dl>
<dt>Giant Bikes</dt>
<dd>Bikes that are very sturdy and reliable.</dd>
</dl>
</li>
<li>
<dl>
<dt>Walmart Bikes</dt>
<dd>Bikes that are crummy and heavy.</dd>
</dl>
</li>
</ol>

关于html - 将定义列表与有序列表结合的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38670807/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com