如果每个元素都嵌套在单独的元素中,我如何计算一个元素?
.variant--name::before {
counter-increment: section;
content: "Abschnitt " counter(section) ": ";
}
<div class="variant--group">
<h3 class="variant--name">variant</h3>
</div>
<div class="variant--group">
<h3 class="variant--name">variant</h3>
</div>
<div class="variant--group">
<h3 class="variant--name">variant</h3>
</div>