Custom Numbered List Template
An ordered list that transforms default numbers into large, beautifully styled visual elements.
This template is ideal for recipes, tutorials, or any step-by-step guide where you want the numbering to be a prominent design feature.

About this Template
This component leverages the power of CSS counters to create a highly stylized ordered list. It starts with a semantic ol
element but hides the default numbering. Then, it uses the ::before
pseudo-element on each list item to generate and style a custom number, which can be designed independently of the list's text content. This provides enormous creative freedom while maintaining a clean, accessible HTML structure.
Features
- Semantic Foundation: Uses a standard
ol
for a properly structured, numbered list. - CSS Counters: Replaces browser default numbers with completely custom-styled counters generated by pure CSS.
- Clean, Modern Design: A minimalist aesthetic with large, visually appealing numbers and clean typography.
- Self-Contained: All CSS is scoped to the
.custom-numbered-list-template
parent class to prevent style conflicts. - Easy Theming: Key design values like colors and fonts are controlled by CSS variables for quick and easy customization.
Code Breakdown
First, on the ol
element (classed as .custom-numbered-list
), we set list-style: none
to remove the default numbers. We also initialize a new counter using counter-reset
.
The main part is the rule for the ::before
pseudo-element of each li
. Inside this pseudo-element, we use counter-increment
to increase our counter's value for each item. Then, we use the counter()
function inside the content
property to display the number. This generated number is then styled with its own font size, color, and positioning to create the final effect.
Code
Here's the full code for the template: