CSS

@counter-style.speak-as

@counter-style.speak-as

speak-as描述符指定如何与给定构造的计数器符号@counter-style将在所说形式来表示。例如,作者可以指定一个计数器符号作为数字值或者只是用音频提示表示。

Related at-rule@counter-style
初始值auto
适用媒体all
计算值as specified
正规顺序the unique non-ambiguous order defined by the formal grammar

语法

/* Keyword values */ speak-as: auto; speak-as: bullets; speak-as: numbers; speak-as: words; speak-as: spell-out; /* @counter-style name value */ speak-as: <counter-style-name>;

auto如果speak-as指定的值为auto,那么speak-as将根据system描述符的值确定有效值。如果这个值system字母的话,那么这个有效值speak-as就会拼写出来。如果system循环,有效值speak-as将是子弹。如果system扩展,则值speak-as将与扩展样式上指定了speak-as__:auto的值相同。

正式语法

auto | bullets | numbers | words | spell-out | <counter-style-name>where <counter-style-name> = <custom-ident>

示例

HTML

<ul class="list"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul>

CSS

@counter-style speak-as-example { system: fixed; symbols:     ; suffix: " "; speak-as: numbers; } .list { list-style: speak-as-example; }

结果

规格

SpecificationStatusComment
CSS Counter Styles Level 3The definition of 'speak-as' in that specification.Candidate RecommendationInitial definition.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic supportNo support33 (33)No supportNo supportNo support

FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic supportNo support33 (33)No supportNo supportNo support