A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/zh-CN/docs/Web/API/CSSKeyframesRule/length below:

CSSKeyframesRule:length 属性 - Web API

CSSKeyframesRule:length 属性

Baseline 2024

Newly available

CSSKeyframeRule 接口的只读属性 length 返回其列表中 CSSKeyframeRule 对象的数量。你可以通过索引直接在 CSSKeyframeRule 对象上访问每个关键帧规则。

值

非负整数。它的值应与 cssRules 属性的 length 相同。

示例

以下 CSS 包含一个关键帧 at 规则。这将是 document.styleSheets[0].cssRules 返回的第一个 CSSRule。 myRules[0] 返回一个 CSSKeyframesRule 对象。cssRules 属性返回一个包含两个规则的 CSSRuleList。

@keyframes slide-in {
  from {
    transform: translateX(0%);
  }

  to {
    transform: translateX(100%);
  }
}
const myRules = document.styleSheets[0].cssRules;
const keyframes = myRules[0]; // CSSKeyframesRule
console.log(keyframes.length); // 2
规范 浏览器兼容性

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4