A styled ordered list whose nested list should have numbers with letters using CSS counter property

前端 未结 2 1053
粉色の甜心
粉色の甜心 2021-01-25 18:14

I want to add a letter to an

  • -element from a my under
      like from my question:

  • 2条回答
    •  余生分开走
      2021-01-25 18:46

      Try this out:

      ol.main {
        counter-reset: item;
      }
      ol.main li {
        counter-increment: item;
      }
      ol.numbered_style li:before {
        margin-bottom: 5px;
        margin-right: 10px;
        content: counter(item);
        background: blue;
        border-radius: 100%;
        color: white;
        width: 1.2em;
        text-align: center;
        display: inline-block;
      }
      ol.numbered_style ol.numbered_style li {
        counter-increment: subitem;
      }
      ol.numbered_style ol.numbered_style li:before {
        content: counter(item) counter(subitem, lower-alpha);
      }
      ol.none,
      ul.none,
      ol.numbered_style {
        list-style: none;
      }
      1. first
      2. second
      3. third Lorem Ipsum
        1. missing an a after the number
        2. missing a b after the number
        3. missing a c after the number

      1. first
      2. second
      3. third Lorem Ipsum
        1. missing an a after the number
        2. missing a b after the number
        3. missing a c after the number

    提交回复
    热议问题