body {
counter-reset: section; /* On initialise le compteur à 0 */
}
h3::before {
counter-increment: section; /* On incrémente le compteur section */
content: "Section " counter(section) " : "; /* On affiche le compteur */
}
body {
counter-reset: section;
}
h2::before {
counter-increment: section;
content: "Section " counter(section) ": ";
}
<style>
body {
counter-reset: ctr;
}
div.fruit::before {
counter-increment: ctr;
content: counter(ctr) ".) ";
}
</style>
<div class="fruit">Apple</div>
<div class="fruit">Banana</div>
<div class="fruit">Orange</div>