简体   繁体   English

如何在中加入加号 (+)<li> 列表样式?</li>

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

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...}

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;
}

您可以使用图像代替它。

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

With CSS 3 it is better to use the "list-style-type" property.对于 CSS 3,最好使用“list-style-type”属性。

This CSS code would be the easiest and efficient way:此 CSS 代码将是最简单有效的方法:

ul {list-style-type: "+";}

The above response worked for me, but I got some weird bullet spacing so adding a couple of spaces made it appear the same.上面的回复对我有用,但我得到了一些奇怪的项目符号间距,所以添加几个空格使它看起来相同。

ul {list-style-type: "+ ";}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM