


How Can I Create Custom Numbered Lists (e.g., 1.1, 1.2, 1.3) with CSS?
Dec 16, 2024 pm 07:44 PMCustom Numbering in Ordered Lists with CSS
Can ordered lists be styled to display numbers as 1.1, 1.2, 1.3, instead of just 1, 2, 3?
The list-style-type property doesn't offer direct control over sub-numbering. However, there's a clever solution using CSS counters:
1 2 3 |
|
This approach sets a counter for each list item, which is incremented with each nested item. The counters(item, ".") function formats the counter as a number with a dot separator.
To illustrate, consider this HTML markup:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Applying the CSS style would result in the following list:
1 2 3 4 5 6 7 8 9 |
|
This technique provides a flexible way to customize the numbering of ordered lists, allowing for more complex and hierarchical lists with custom separators and numbering schemes.
The above is the detailed content of How Can I Create Custom Numbered Lists (e.g., 1.1, 1.2, 1.3) with CSS?. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Adding Box Shadows to WordPress Blocks and Elements

Create a JavaScript Contact Form With the Smart Forms Framework

Making Your First Custom Svelte Transition

Demystifying Screen Readers: Accessible Forms & Best Practices

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)
