【问题标题】:Is there a way to check for support for specific at-rules in CSS?有没有办法检查对 CSS 中特定规则的支持?
【发布时间】:2022-01-25 04:45:50
【问题描述】:

我正在寻找 @supports 的等价物,但要寻找 at 规则。 所以我希望能够做到

@supports (@counter-style) {
  things
}

我想只使用 CSS/HTML 来做到这一点。

我该怎么做?

【问题讨论】:

    标签: css media-queries


    【解决方案1】:

    未来,遥远的未来:

    CSS 工作组刚刚讨论了描述符的特征检测,并达成以下共识:

    已解决:添加 at-rule 函数,语法为 at-rule(@keyword)at-rule(@keyword; descriptor: value)

    https://github.com/w3c/csswg-drafts/issues/2463#issuecomment-1016720310

    你将能够做到:

    @supports at-rule(@foo) {
      /* @foo is supported */
    }
    

    现在和不久的将来,你不能。

    【讨论】:

      猜你喜欢
      • 2017-02-24
      • 1970-01-01
      • 2015-01-15
      • 1970-01-01
      • 1970-01-01
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多