是否可以修改无序列表的样式,以便使用<ul>
标签在:before
标签的样式中指定该单词时,可以使用实际单词而不是项目符号来实现单词。 1}}选择器?
答案 0 :(得分:6)
您可以使用:before
伪造选择器实现您的目标,而无需使用 {{3}为每个content
定义单独的:before
} 强>
这是一个演示:
ul li {
list-style: none;
}
ul {
counter-reset: my-badass-counter;
}
ul li:before {
content: 'S'counter(my-badass-counter)'.';
counter-increment: my-badass-counter;
margin-right: 5px;
font-weight: bold;
position: absolute;
margin-left: -25px;
}
<ul>
<li>One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One. One./li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
<li>Eight</li>
</ul>