How can you customize the numbers in an ordered list?
Customize ordered list numbers using CSS list-style-type
for preset styles, or counter
properties for complete customization.
Preset styles (disc
, circle
, square
, decimal
, lower-roman
, etc.):
Custom counter:
Results in "1"., "2"., etc.
Advanced customizations: Owning the counters in CSS
CSS counters
are your weapon to challenge conventional numbered lists.
Multi-level lists that impress
Create multi-tiered lists, like document outlines:
Mastering number alignment for clean layout
Tweak padding
or margin
, ensuring your numbers are symmetrically aligned for a spotless layout:
Counters showcasing prefixes and suffixes
Explore the power of CSS content
property to add suffixes or prefixes to turn numbers into stylish elements:
Custom starting point for lists
HTML5 start
attribute resets the starting point of list numeration:
Utilizing HTML5 value attributes
For precision control over list item numbers, value
attribute is there:
Cross-browser compatibility
Ensure cross-browser compatibility. Remember, the behavior of CSS counters might slightly vary among different browsers.
Was this article helpful?