所以我正在标记客户的网页设计。该页面是一个常见问题解答页面,其中每个常见问题解答部分都有一个问题和答案列表。对于这种情况,最合适的语义标记是 html 定义列表。
客户的模型还在每个问题/答案对旁边显示数字,例如有序列表。
所以很自然地我想我会用<dl>
元素标记内容,并使用 CSS 来添加list-style-type: decimal
. 然而,这完全被忽略了。
是因为<dl>
元素不能接受列表样式吗?这似乎非常倒退,因为它毕竟是一个列表元素!
还是我的标记做错了什么?
这是我的代码 CSS 和 HTML 的示例:
dl { list-style: decimal; }
<dl class="some-list">
<dt><strong>Q</strong>: How Do I Do Some Thing?</dt>
<dd><p><strong>A:</strong> You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this:</p>
</dd>
<dt><strong>Q</strong>: How Do I Do Some Other Thing?</dt>
<dd><p><strong>A:</strong> You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this: You just do it, okay? Want a longer explanation? Try this:</p>
</dd>
</dl>