I want this:
1. Main
1.1 sub1
1.2 sub2
2. Main2
2.1 sub3
is it possible to do this in HTML? Thanks.
This solution works for me:
/* hide original list counter */
ol li {display:block;}
/* OR */
ol {list-style:none;}
ol > li:first-child {counter-reset: item;} /* reset counter */
ol > li {counter-increment: item;} /* increment counter */
ol > li:before {content:counters(item, ".") ". "; font-weight:bold;} /* print counter */
Yes, at least in a modern browser:
li li:before {
counter-increment: item;
content: counter(item) ". ";
}
(The li li
is so it only does this after the first level.)
You'll probably need counter-reset
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With