Skip to content

Latest commit

 

History

History
28 lines (12 loc) · 655 Bytes

CSS Counters.md

File metadata and controls

28 lines (12 loc) · 655 Bytes

CSS Counters

c

CSS Counters allow you to create automatic numbering and labeling for your content. Here's an example:

ol {

counter-reset: my-counter;

list-style-type: none;

}

li::before {

content: counter(my-counter) ". ";

counter-increment: my-counter;

}

In this code, we have an ordered list with a custom counter called my-counter defined by the counter-reset property. We use the ::before pseudo-element to insert the counter label before each list item and increment the counter using the counter-increment property.