简体   繁体   English

css对段号的反增量

[英]css counter-increment for section numbers

I am trying to get the css Counter to work. 我想让css Counter工作。 It works fine until I have a,b,c in one of the list items, then it messes up. 它工作正常,直到我在其中一个列表项中有a,b,c,然后它就会混乱。 This is what I want to display 这就是我想要展示的内容

1. ACKNOWLEDGEMENTS

 1.1   blah blah blah
 1.2   blah blah blah
 1.3   blah blah blah

2. Risk Statement

 2.1   blah blah blah
 2.2   blah blah blah
 2.3   blah blah blah

3. License
 3.1   blah blah blah
 3.2   blah blah blah
   a blah blah blah
   b blah blah blah
   c blah blah blah
 3.3   blah blah blah

4. License
 4.1   blah blah blah
 4.2   blah blah blah
 4.3   blah blah blah

What is happening is that a,b,c is being counted so 3.3 is displaying as 4.3 and then section 4 is starting at 5.1....Here it is in JSFiddle(a,b,c are not showing but ignore that - the numbering is the important thing)... http://jsfiddle.net/XQKcy/11/ 发生的事情是a,b,c正在计算,所以3.3显示为4.3然后第4节从5.1开始....这里是JSFiddle(a,b,c没有显示但忽略了 - 编号是重要的事情)... http://jsfiddle.net/XQKcy/11/

The ol li will affect all li elements within the list, even those of child ol elements. ol li将影响列表中的所有li元素,甚至是子ol元素的li元素。

As such you need to identify the immediate children, and only apply to those, using ol>li syntax. 因此,您需要使用ol>li语法识别直接子项,并仅应用于这些子项。

See the updated fiddle - http://jsfiddle.net/XQKcy/14/ 看到更新的小提琴 - http://jsfiddle.net/XQKcy/14/

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

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