gpt4 book ai didi

html - 如何在 HTML 列表中使用字母 "Q"和 "A"

转载 作者:太空狗 更新时间:2023-10-29 14:40:18 24 4
gpt4 key购买 nike

是否可以在 HTML 或 CSS 中设置列​​表以使用特定字母而不是元素符号?

例子:

Q. a question will be posted here.
A. the answer will go here.

我知道我可以进入并格式化每个条目,但我更愿意修改个人 <li>带有类的标签。

最佳答案

语义上,一个 <dl>更适合 Q/A。您可以使用 :before 像这样的伪元素:

dt:before {
content: 'Q. ';
}
dd:before {
content: 'A. ';
}
<dl>
<dt>Is this a question?</dt>
<dd>Yes, it is.</dd>
</dl>

注:根据the documentation对于 <dl> (强调我的):

Name-value groups may be terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data.

关于html - 如何在 HTML 列表中使用字母 "Q"和 "A",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18340628/

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