HTML + CSS: Numbered list with numbers inside of circles

前端 未结 9 2135
清酒与你
清酒与你 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-11-30 23:58

    I think I found out a solution for that. Your HTML code would be

    1. First item
    2. Second item

    If you apply the following styles, it gets quite like a circle:

    ol {margin-left:0; padding-left:0; counter-reset:item}
    ol>li {margin-left:0; padding-left:0; counter-increment:item; list-style:none inside;margin-bottom:10px}
    ol>li:before {
    content:"(" counter(item) ")";
    padding:3px 5px;
    margin-right:0.5em;
    background:#ccc;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px; 
    }
    

    I would then play around with paddings and radius in order to make it appear as a circle

提交回复
热议问题