22 de abril de 2022 • 1 min de leitura
HTML + CSS: Contadores e escopo aninhados
Como criar uma lista com tópicos e subtópicos
<ol>
<li>one</li>
<li>
two
<ol>
<li>two.one</li>
<li>two.two</li>
<li>two.three</li>
</ol>
</li>
<li>
three
<ol>
<li>three.one</li>
<li>
three.two
<ol>
<li>three.two.one</li>
<li>three.two.two</li>
</ol>
</li>
</ol>
</li>
<li>four</li>
</ol>
ol {
counter-reset: item;
}
li {
display: block;
}
li:before {
content: counters(item, ".") " ";
counter-increment: item;
}