How can I prefix ordered list item numbers with a static string using CSS?

后端 未结 2 530
情深已故
情深已故 2020-12-01 16:12

I want this HTML...

  1. Apples
  2. Oranges

...to ren

2条回答
  •  孤街浪徒
    2020-12-01 16:50

    There is a, fragile, non-counter method, but it's prone to breaking:

    ol {
        list-style-type: decimal;
        margin: 0 0 0 2em;
    }
    
    li {
        position: relative;
    }
    
    ol li:first-letter {
        color: #f90;
        float: left;
        position: relative;
        margin-left: -2em;
    }
    

    JS Fiddle demo.

提交回复
热议问题