Html 如何在 <li> 列表样式中使用加号 (+)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18940240/
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 13:39:51  来源:igfitidea点击:

How to have Plus sign (+) in <li> list-style?

htmlcsshtml-lists

提问by abcid d

I wonder if we can use the Plus sign in the list style. Instead of Disc, Circle... in <li>List-style, can we have a plus sign?

我想知道我们是否可以在列表样式中使用加号。在<li>列表样式中,我们可以使用加号代替 Disc、Circle...吗?

li {list-style: disc...}

回答by dhouty

There is no list-style for a plus sign like there is for the disc, circle, etc., but you can achieve similar results using the :before selector together with the content property.

没有像圆盘、圆等那样的加号列表样式,但是您可以使用 :before 选择器和 content 属性获得类似的结果。

Here is the CSS code to get it to work:

这是使其工作的CSS代码:

ul {
    list-style: none;
}

li:before {
    content: "+";
    margin-right: 4px;
}

回答by Joyce Lee

you can use a image instead of it.

您可以使用图像代替它。

li{list-style-image:url('...');}