是否有类似于list-style-type的CSS计数器?

时间:2016-03-28 07:44:12

标签: css css3 css-counter

CSS为list-style-type提供了很好的值集合,有没有办法将它们用作content: counter(steps)的值?

我想在计数器值中使用list-style-type: persian

结果将是:

۱ // (one)
۲ // (two)
۳ // (three)
۴ // (four)
۵ // (five)
...

1 个答案:

答案 0 :(得分:2)

是的,counter() function takes the style type as a parameter。语法如下:

  

counter()= counter(< ident> [,[< counter-style> | none]]?)

body {
  counter-reset: divs;
}
div {
  counter-increment: divs;
}
div:before {
  content: counter(divs, persian);
}
<div>Text</div>
<div>Text</div>
<div>Text</div>
<div>Text</div>
<div>Text</div>