Can I style numbering an ordered list that has a start attribute value?

前端 未结 4 727
小鲜肉
小鲜肉 2020-12-20 23:27

Here\'s the problem:

I have an ol li ordered list with a start attribute like so:

4条回答
  •  甜味超标
    2020-12-21 00:22

    I've added a few rules to your CSS. The most important is this:

    .custom{counter-reset:start 5;} 
    

    This will make the list to start at 5+1 = 6

    .custom {
      margin: 0;
      padding: 0;
      list-style-type: none;
      counter-reset:start 5;/*This*/
    }
    
    .custom li {
      counter-increment: step-counter;
      margin-bottom: 10px;
      counter-increment: start;/*This*/
    }
    
    .custom li::before {
      content:counter(start);/*This*/
      margin-right: 5px;
      font-size: 80%;
      background-color: rgb(0,200,200);
      color: white;
      font-weight: bold;
      padding: 3px 8px;
      border-radius: 3px;
    }
    1. This is the sixth item
    2. This is the seventh item
    3. This is the eighth item
    4. This is the ninth item
    5. This is the tenth item

提交回复
热议问题