简体   繁体   English

如何将<ul>项目符号列表样式设置为代码十进制?

[英]How do you set <ul> bullet's list-style to a code decimal?

I have a ul that I want to set the bullet style of with the code decimal of &#10003 (checkmark). 我有一个ul ,我想设置子弹样式与代码十进制&#10003 (复选标记)。 Is there any way to do this? 有没有办法做到这一点? I tried list-style-image , but it didn't work. 我尝试了list-style-image ,但它没有用。

You will need to apply a workaround here: 您需要在此处应用解决方法:

ul { list-style: none; }
ul li:before { content: "\2713"; }

Then adapt padding and margin of ul, li and li:before to your liking. 然后根据自己的喜好调整ul,li和li的填充和边距: This won't work in IE < 8, though. 但是,这在IE <8中不起作用。 There you will have to use images or JavaScript (or putting it in the markup, if you really need to support them). 在那里你将不得不使用图像或JavaScript(或者将它放在标记中,如果你真的需要支持它们)。

Closest you can likely get is something hacky like: 你可能得到的最近的东西就像是hacky:

ul {
  list-style-type: none;
  padding: 0;
}

ul li:before {
content: "\2713";
}

You can specify the type through list-style-type (however you're limited to the pre-set values, otherwise if you want to use list-style-image you must supply an image, not a character. 您可以通过list-style-type指定list-style-type (但是您只能使用预设值,否则如果要使用list-style-image ,则必须提供图像,而不是字符。

Otherwise, use the :before selector as others have suggested. 否则,请使用:before选择器,如其他人所建议的那样。

list-style-type是你要找的。

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

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