CSS 向 dd 元素添加项目符号样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1721116/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:15:33  来源:igfitidea点击:

Add bullet styling to dd element

cssxhtml

提问by Joemon

I am using dl, dtand ddtags in one of my projects. I want to show a bullet before dd. How can I make my dds into a bullet list using CSS?

我在我的一个项目中使用dl,dtdd标签。我想先展示一个子弹dd。如何dd使用 CSS将我的s 变成项目符号列表?

回答by Jonny Haynes

Easiest way is to change the properties on your <dd>

最简单的方法是更改​​您的属性 <dd>

dd {
    display: list-item;
    list-style-type: disc;
    }

Works in every browser.

适用于所有浏览器。

See this article: http://www.quirksmode.org/css/display.html

见这篇文章:http: //www.quirksmode.org/css/display.html

回答by anddoutoi

Use a background-image.

使用背景图像。

Or try:

或尝试:

dd
{
    display: list-item;
    list-style-type: disc;
}

No idea if it will work though.

不知道它是否会起作用。

回答by Ramuns Usovs

tested it in firefox and just adding the style display:list-item should do the trick

在 Firefox 中对其进行了测试,只需添加样式 display:list-item 即可解决问题

回答by Riza Dindir

You can either use the style attribute in the "dd" tag, or move that to a "style" section as a class or id. Since the dl is a list type you do not need the "display: list-item;" I think, might also be wrong. Anyways This might be used. Instead of the disc, you might use other types (look at http://www.w3schools.com/css/pr_list-style-type.asp)...

您可以在“dd”标签中使用 style 属性,也可以将其作为类或 id 移动到“style”部分。由于 dl 是列表类型,因此您不需要“display: list-item;” 我想,也可能是错的。无论如何 这可能会被使用。您可以使用其他类型而不是光盘(查看http://www.w3schools.com/css/pr_list-style-type.asp)...

<html>
  <body>
    <dl>
      <dt>Term</dt>
      <dd style="display: list-item;">Term description</dd>
    </dl>
  </body>
</html>

Hope this helps.

希望这可以帮助。