简体   繁体   English

自定义排序列表格式

[英]Custom ordered list format

我尝试使用有序列表<ol> ,每个列表项<li>输出为1. 2. 3. ...等,我希望输出为1)2)3)...等,可以这样做?

You can, but only with the more up-to-date browsers (Chrome, Safari, Firefox and Opera will work): 您可以,但只能使用更新的浏览器(Chrome,Safari,Firefox和Opera可以使用):

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: 您可以使用CSS计数器和伪元素执行此操作:

 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> 

不,有效选项列在此处<

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

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