HTML + CSS: Numbered list with numbers inside of circles

前端 未结 9 2137
清酒与你
清酒与你 2020-11-30 23:25

I\'m trying to create an ordered list in CSS + HTML that looks like this: \"CSS

I can\'t for the

9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 00:03

    content:counter(li) with increment doesn't work in my less so I found some wokraround:)

    li {
    position: relative;
    line-height: 2.5em;
    list-style-type: none;
    &:before{
      content: '';
      position: absolute;
      left: -29px;
      top: 7px;
      display: block;
      background: @btn-bg-secondary;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      color: @bg-color-primary;
      padding-left: 7px;
      line-height: 1.5em;
    }
    &:nth-child(1):before{
      content: '1';
    }
    &:nth-child(2):before{
      content: '2';
    }
    &:nth-child(3):before{
      content: '3';
    }
    &:nth-child(4):before{
      content: '4';
    }
    &:nth-child(5):before{
      content: '5';
    }
    &:nth-child(6):before{
      content: '6';
    }
    &:nth-child(7):before{
      content: '7';
    }
    &:nth-child(8):before{
      content: '8';
    }
    }
    

    http://jsfiddle.net/du6ezxj7/

提交回复
热议问题