Number nested ordered lists in HTML
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-04-28T13:42:20Z
Indexed on
2010/04/28
14:33 UTC
Read the original article
Hit count: 1087
Hi
I have a nested ordered list.
<ol>
<li>first</li>
<li>second
<ol>
<li>second nested first element</li>
<li>second nested secondelement</li>
<li>second nested thirdelement</li>
</ol>
</li>
<li>third</li>
<li>fourth</li>
</ol>
Currently the nested elements start back from 1 again, e.g.
- first
- second
- second nested first element
- second nested second element
- second nested third element
- third
- fourth
What I want is for the second element to be numbered like this:
- first
second
2.1. second nested first element
2.2. second nested second element
2.3. second nested third element
- third
- fourth
Is there a way of doing this?
Thanks
© Stack Overflow or respective owner