是否有任何方法可以删除列表样式中小数后的DOT?
我的CSS
.snum li {list-style:decimal outside none;}
我得到的结果是这样的(不包括PHP和HTML代码)
1. MILK
2. SOYA
3. BEANS
4. GARLIC
期望输出应该是这样的。
1 MILK
2 SOYA
3 BEANS
4 GARLIC
您可以通过在有序列表中的每个<li>
之前将自定义计数器实现为伪元素来实现这一点:
HTML:
<ol>
<li>STUFF</li>
<li>Stuff</li>
<li>Stuff</li>
</ol>
CSS:
ol
{
list-style: none;
margin-left: 0;
}
li
{
counter-increment: custom;
}
ol li:before
{
content: counter(custom) " ";
}
ol li:first-child {
counter-reset: custom;
}
JSFiddle