Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. CSS
  3. Reference
  4. At-rules
  5. @counter-style
  6. fallback

fallback

Baseline 2023
Newly available

Since ⁨September 2023⁩, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Thefallback descriptor of the@counter-style at-rule can be used to specify a counter style to fall back to if the counter style being defined cannot create a marker representation for a particular counter value.

Syntax

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

Value

The descriptor takes a single<counter-style-name> as its value:

<counter-style-name>

Provides the name of the counter style to be used as the fallback, which is either the case-sensitive<custom-ident> of a custom CSS counter style (without quotes) or a case-insensitivelist-style-type property value such asdecimal,disc, and so on.

If omitted, the counter fallback defaults todecimal.

Description

The counter style provided as the value of thefallback descriptor is used when arange descriptor is specified for a counter style; thefallback style is used to represent all the values that fall outside the range. Thefallback style is also used when thefixedsystem is used and there are not enough symbols to cover all the list items; thefallback style is used to represent all the values beyond the scope of the fixed system. In both these cases, and any other time the defined counter cannot create a specific counter value, thefallback style is used.

If the specified fallback style is also unable to construct a representation, then thefallback value of that fallback counter is used. If that fallback style's fallback is also unable to construct a representation, then that fallback's fallback is used. This falling back continues until a fallback is found that can construct the counter-representation. If no fallbackfallback value is able to construct a representation―if a fallback style doesn't have afallback value set, or if afallback value is not specified or invalid―thefallback defaults todecimal.

Formal definition

Relatedat-rule@counter-style
Initial valuedecimal
Computed valueas specified

Formal syntax

fallback =
<counter-style-name>

Examples

Specifying a fallback counter style

HTML

html
<ul>  <li>One</li>  <li>Two</li>  <li>Three</li>  <li>Four</li>  <li>Five</li></ul>

CSS

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

Result

Specifications

Specification
CSS Counter Styles Level 3
# counter-style-fallback

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp