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.

A screenshot of an ordered list with large, custom-styled numbers.

Get Source Code Preview

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

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:

View Output