This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The CSSKeyframesRule
interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes
at-rule. It implements the CSSRule
interface with a type value of 7
(CSSRule.KEYFRAMES_RULE
).
As a CSSRule
, CSSKeyframesRule
also implements the properties of these interfaces. It has two properties :
CSSKeyframesRule.name
animation-name
property.CSSKeyframesRule.cssRules
Read only
CSSRuleList
of the CSS rules in the media rule.As a CSSRule
, CSSKeyframesRule
also implements the methods of that interface. It has three specific methods:
CSSKeyframesRule.appendRule()
DOMString
containing a keyframe in the same format as an entry of a @keyframes
at-rule. If it contains more than one keyframe rule, a DOMException
with a SYNTAX_ERR
is thrown.CSSKeyframesRule.deleteRule()
DOMString
resolving as a number between 0
and 1
.CSSKeyframesRule.findRule()
DOMString
containing an index of the keyframe to be returned, resolving to a number between 0
and 1
. If no such keyframe exists, findRule
returns null
.Specification | Status | Comment |
---|---|---|
CSS Animations The definition of 'CSSKeyframesRule' in that specification. | Working Draft | Initial definition |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) |
5.0 (5.0) -moz 48 (48) | 10 | 12 -o 12.10 | 4.0 |
appendRule | (Yes)[1] | ? |
5.0 (5.0)[2] 22.0 (22.0) | 10[3] | (Yes)[3] | (Yes)[3] |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | ? | (Yes) | (Yes) |
5.0 (5.0) -moz 48 (48) | (Yes) | 12 -o 12.10 | (Yes) | (Yes) |
appendRule | ? | (Yes)[1] | ? | 5.0 (5.0)[2] 22.0 (22.0) | (Yes)[3] | (Yes)[3] | (Yes)[3] | (Yes)[1] |
[1] The non-standard name insertRule()
was removed in Chrome 45.
[2] Gecko 5.0 implemented this with the non-standard name insertRule()
. In Gecko 22.0 it was changed to the standard name appendRule
.
[3] Internet Explorer 10, Safari and Opera implement this with the non-standard name insertRule()
.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframesRule