fallback descriptor can be used to specify a counter style to fall back to if the current counter style cannot create a marker representation for a particular counter value.

句法

/* Keyword values */
fallback: lower-alpha;
fallback: custom-gangnam-style;
					

描述

If the specified fallback style is also unable to construct a representation, then its fallback style will be used. If a valid fallback style is not specified, it defaults to decimal .

A couple of scenarios where a fallback style will be used are:

  • When the range descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range.
  • When the fixed system is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items.

形式定义

相关 at-rule @counter-style
初始值 decimal
计算值 如指定

形式句法

<counter-style-name>

where
<counter-style-name> = <custom-ident>

范例

Specifying a fallback counter style

HTML

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

CSS

@counter-style fallback-example {
  system: fixed; symbols: "\24B6" "\24B7" "\24B8";
  fallback: upper-alpha;
}
.list {
  list-style: fallback-example;
}
						

结果

规范

规范 状态 注释
CSS Counter Styles Level 3
The definition of 'fallback' in that specification.
候选推荐 初始定义

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
fallback Chrome 不支持 No Edge 不支持 No Firefox 完整支持 33 IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 完整支持 33 Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: