I tried to create a custom Ordered List (OL
) using "CSS Counters" taking as example this Mozilla article.
I need to slightly modify it, wrapping last OL in a DIV containter named .foo
, as shown in this jsFiddle.
<div id='foo'>
<ol>
<li>item</li> <!-- 1 -->
<li>item</li> <!-- 2 -->
</ol>
</div>
ol {
counter-reset: section;
list-style-type: none;
}
li::before {
counter-increment: section;
content: counters(section,".") " ";
}
Adding wrapper, counter does not reset anymore and numbers continue from 4.1 and 4.2. Why? How to reset new counter even if is wrapped inside a container? Thanks
Add counter reset to the div and assign a new value to the wrapped ol. Fiddle: http://jsfiddle.net/mbmg52sz/3/