开发者

Custom ordered list format

I tried t开发者_运维知识库o use ordered list <ol> and each list item <li> outputs as 1. 2. 3. ... etc, I want the output to be 1) 2) 3) ... etc, can this be done?


You can, but only with the more up-to-date browsers (Chrome, Safari, Firefox and Opera will work):

ol {
  counter-reset: listCounter;
}
ol li {
  counter-increment: listCounter;
}
ol li:before {
  content: counter(listCounter) ")";
}


You can do this with CSS counter and pseudo elements:

ol li{
    list-style: none;
    counter-increment: myIndex;
}

ol li:before{
    content:counter(myIndex)") ";
}
<ol>
    <li>test</li>
    <li>test</li>
    <li>test</li>
    <li>test</li>
    <li>test</li>
</ol>


No, the valid options are listed >here<.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜