CSS counters

CSS can keep count of numbers without writing any additional JavaScript. It does this by taking note the amount of time a CSS block affects a page then incrementing the counter for that block if the counter-increment rule is implemented. For example: input:invalid { counter-increment: invalid-count; } With no JavaScript at all, CSS understands that whenever there is an invalid element, it should increment the count for the invalid-count identifier....

June 7, 2021 · 2 min · Aleem Isiaka