A Guide to CSS counter

Samantha Ming
5 min readMar 25, 2019
CodeTidbit by SamanthaMing.com

Use the counter property to turn any element into a numbered list. Similar to how the ordered list tag works <ol>. Very useful if you're creating a documentation site where you need to automatically number the headings or create a table of contents 👍

div {
/* Define & Initialize Counter */
counter-reset: tidbit-counter;
}
h2::before {
/* Increment Counter */
counter-increment…

--

--

Samantha Ming

Frontend Developer sharing weekly JS, HTML, CSS code tidbits🔥 Discover them all on samanthaming.com 💛