CSSKeyframeRule.style

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.

CSSKeyframeRule.style プロパティは CSSStyleDeclaration インターフェイスであり、 CSSKeyframeRule宣言ブロックです。

CSSStyleDeclaration オブジェクトで、次のプロパティがあります。

readonly flag

未設定。

declarations

このルール内で宣言された宣言で、指定された順番であり、個別指定プロパティに展開された一括指定プロパティです。

parent CSS rule

コンテキストオブジェクトで、 this の別名です。

owner node

null です。

この CSS には keyframes アットルールが記載されています。これは最初の CSSRule であり、 document.styleSheets[0].cssRules で返されます。 myRules[0]CSSKeyframesRule オブジェクトを返し、その中に各キーフレームに対応する個々の CSSKeyFrame オブジェクトが格納されます。

css
@keyframes slidein {
  from {
    transform: translateX(0%);
  }

  to {
    transform: translateX(100%);
  }
}
js
let myRules = document.styleSheets[0].cssRules;
let keyframes = myRules[0]; // a CSSKeyframesRule
console.log(keyframes[0].style); // a CSSStyleDeclaration

仕様書

Specification
CSS Animations Level 1
# dom-csskeyframerule-style

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
style

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support