Skip to content

Instantly share code, notes, and snippets.

@asifvora
Created March 15, 2019 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asifvora/e8ffb5618f5f6289cec9e50949b978c6 to your computer and use it in GitHub Desktop.
Save asifvora/e8ffb5618f5f6289cec9e50949b978c6 to your computer and use it in GitHub Desktop.
Counters are, in essence, variables maintained by CSS whose values may be incremented by CSS rules to track how many times they're used.
<style>
ul {
counter-reset: counter;
}
li::before {
counter-increment: counter;
content: counters(counter, '.') ' ';
}
</style>
<ul>
<li>List item</li>
<li>List item</li>
<li>
List item
<ul>
<li>List item</li>
<li>List item</li>
<li>List item</li>
</ul>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment