简体   繁体   中英

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):

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> 

不,有效选项列在此处<

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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