如果设置了元素,我怎样才能不将其排除在计数之外display: none;
?
body {
counter-reset: section;
}
.variant--name::before {
counter-increment: section;
content: counter(section) ": ";
}
.hidden {
display: none;
}
<div class="variant--group">
<h3 class="variant--name">variant</h3>
</div>
<div class="variant--group hidden">
<h3 class="variant--name">variant</h3>
</div>
<div class="variant--group">
<h3 class="variant--name">variant</h3>
</div>