Now, please, before everyone starts called this a duplicate, read the situation. I'm aware of solutions to this in a straight-forward manner, but they are NOT "dynamic". Let me show you what I mean:
Using a variation of the solution found at Ordered list CSS style includes parent number to restrict the effects to OL
with .parented
applied, I've got this:
ol.parented {
counter-reset: parent;
margin-left: .6875em !important;
}
ol.parented, .parented ol {
list-style: none !important;
}
ol.parented > li:before {
counter-increment: parent;
content: counter(parent) ".";
padding-right: 9px;
}
ol.parented li ol {
counter-reset: child;
}
ol.parented ol li:before {
counter-increment: child;
content: counter(parent) "." counters(child, '.');
padding-right: 9px;
}
This allows
<ol class="parented">
<li>Value 1<ol>
<li>Value 1.1</li>
<li>Value 1.2</li>
<li>Value 1.3</li>
</ol></li>
<li>Value 2<ol>
<li>Value 2.1</li>
<li>Value 2.2</li>
<li>Value 2.3</li>
</ol></li>
<li>Value 3<ol>
<li>Value 3.1</li>
<li>Value 3.2</li>
<li>Value 3.3</li>
</ol></li>
</ol>
to appear like
1. Value 1
1.1 Value 1.1
1.2 Value 1.2
1.3 Value 1.3
2. Value 2
2.1 Value 2.1
2.2 Value 2.2
2.3 Value 2.3
3. Value 3
3.1 Value 3.1
3.2 Value 3.2
3.3 Value 3.3
What it doesn't allow is for the skipping for values (defining which value is next). As such, if I were to use
<ol class="parented">
<li value="4">Value 4<ol>
<li>Value 4.1</li>
<li>Value 4.2</li>
<li>Value 4.3</li>
</ol></li>
</ol>
I get
1. Value 4
1.1 Value 4.1
1.2 Value 4.2
1.3 Value 4.3
Does anyone know how I can manipulate the counter to use the updated LI
values to reflect in the generated list? In other words, my last snippet should look like
4. Value 4
4.1 Value 4.1
4.2 Value 4.2
4.3 Value 4.3