fallback - CSS: Cascading Style Sheets 编辑

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 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.

    Formal definition

    Related at-rule@counter-style
    Initial valuedecimal
    Computed valueas 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;
    }

    Result

    Specifications

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

    Browser compatibility

    BCD tables only load in the browser

    See also

    如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
    列表为空,暂无数据

    词条统计

    浏览:113 次

    字数:4980

    最后编辑:6 年前

    编辑次数:0 次

      我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
      原文