[英]How to use an asterisk in list items instead of a bullet
I want to use "*" in one of the bullet items.我想在项目符号之一中使用“*”。 I have used Pseudo class to one of the element.我已经将伪类用于元素之一。 But i see some blank space before "text2" in below example to the pseudo li
element但是我在下面的示例中看到伪li
元素的“text2”之前有一些空格
li { list-style: none; } li.str:before { content: "*"; position: relative; left: -15px; bottom: -3px; }
<ul> <li>text1</li> <li class="str">text2</li> </ul>
Could you please help me here你能在这里帮助我吗
Set your li tags in position relative and your pseudo-element in position absolute :将 li 标签设置在相对位置,将伪元素设置在绝对位置:
li { position: relative; list-style: none; } li.str:before { content: "*"; position: absolute; left: -15px; bottom: -3px; }
<ul> <li>text1</li> <li class="str">text2</li> </ul>
use an image使用图像
http://jsbin.com/vitumerahe/edit?html,css,output
ul { list-style-image: url("http://4.bp.blogspot.com/-mpLQ5__-LI/VJRpKS3KtGI/AAAAAAAAMXA/YfYAJql--mU/s1600/star.png") }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <ul> <li>text1</li> <li>text2</li> </ul> </body> </html>
As Mentioned by others you can use List.正如其他人提到的,您可以使用 List。 If you want to show in between words, you can use html code before the text like below如果要显示在单词之间,可以在文本之前使用 html 代码,如下所示
*
Output输出
* Text1 * 文本1
* Text2 * 文本 2
* Text3 * 文本 3
And so on...等等...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.