CSS 计数器 - 仅与 content 属性一起使用?

Ric*_*uen 5 css

根据规范,CSS 计数器是否只能与content属性一起使用?

* { content: counter(mycounter) "! "; counter-increment: mycounter }
Run Code Online (Sandbox Code Playgroud)

或者它们也可以/将与其他属性一起使用,例如(随机示例)padding

/*
    is this possible?
    is this supposed to be possible?
*/
* { padding:counter(mycounter)px; }
Run Code Online (Sandbox Code Playgroud)

最后,如果这是 CSS 的一个特性,那么它在浏览器中的实现程度如何?

Bol*_*ock 5

在 CSS2.1 中,counter()函数确实被定义为content仅与属性一起使用;您不能使用计数器来指定其他属性的数值。