fallback
Quick Summary for fallback (@counter-style)
The
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.
Code Usage for fallback (@counter-style)
/* Keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style;
More Details for fallback (@counter-style)
fallback
The 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.
Syntax
/* Keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style;
Description
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 therange
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. Formal definition
Related at-rule | @counter-style |
---|---|
Initial value | decimal |
Computed value | as specified |
Formal syntax
<counter-style-name>where
<counter-style-name> = <custom-ident>
Examples
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; }
ResultSpecifications
Specification |
---|
CSS Counter Styles Level 3 # counter-style-fallback |
See also
list-style
, list-style-image
, list-style-position
symbols()
: the functional notation creating anonymous counter styles Last modified: Dec 20, 2021, by MDN contributors
Posted in
12:22 am, February 22, 2022
Add Comment
Other Items in CSS
rgb()
rgba()
:right
right
@right-bottom
:root
rotate
rotate()
rotate3d()
rotateX()
rotateY()
rotateZ()
row-gap
ruby-align
ruby-position
saturate()
scale
scale()
scale3d()
scaleX()
scaleY()
scaleZ()
:scope
scroll-behavior
scroll-margin
scroll-margin-block
scroll-margin-block-end
scroll-margin-block-start
scroll-margin-bottom
scroll-margin-inline
scroll-margin-inline-end
scroll-margin-inline-start
scroll-margin-left
scroll-margin-right
scroll-margin-top
scroll-padding
scroll-padding-block
scroll-padding-block-end
scroll-padding-block-start
scroll-padding-bottom
scroll-padding-inline
scroll-padding-inline-end
scroll-padding-inline-start
scroll-padding-left
scroll-padding-right
scroll-padding-top
scroll-snap-align
scroll-snap-stop
scroll-snap-type
@scroll-timeline