Custom list style for ordered lists

前端 未结 1 483
庸人自扰
庸人自扰 2021-01-22 15:33

Is it possible to define a style for an ordered list that renders something like

  1. Item 1
  2. Item 2
  3. <
相关标签:
1条回答
  • 2021-01-22 15:55

    You can use css counter and :before pseudo-element to create this type of list.

    ol {
      counter-reset: custom;
      list-style-type: none;
    }
    
    ol li:before {
      content: '('counter(custom)') ';
      counter-increment: custom;
    }
    <ol>
       <li>Item 1</li>
       <li>Item 2</li>
       <li>Item 3</li>
    </ol>

    0 讨论(0)
提交回复
热议问题