Custom list style for ordered lists

前端 未结 1 641
庸人自扰
庸人自扰 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;
    }
    1. Item 1
    2. Item 2
    3. Item 3

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