Skip ordered list item numbering

前端 未结 5 2069
轮回少年
轮回少年 2021-02-18 22:34

I have an ordered list and I\'d like to skip the number output from a particular item.

Traditional output:

1. List item
2. List item
3. List item
4. List         


        
5条回答
  •  猫巷女王i
    2021-02-18 23:24

    Another option is to use CSS3 counters: demo

    HTML

    • One
    • Two
    • Three
    • Four

    CSS

    ul {
        counter-reset:yourCounter;
    }
    ul li:not(.skip) {
        counter-increment:yourCounter;
        list-style:none;
    }
    ul li:not(.skip):before {
        content:counter(yourCounter) ".";
    }
    ul li.skip:before {
        content:"\a0\a0\a0"; /* some white-space... optional */
    }
    

提交回复
热议问题