W3cubDocs

/DOM

CSSKeyframesRule

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

Properties

As a CSSRule, CSSKeyframesRule also implements the properties of these interfaces. It has two properties :

CSSKeyframesRule.name
Represents the name of the animation, used by the animation-name property.
CSSKeyframesRule.cssRules Read only
Returns a CSSRuleList of the CSS rules in the media rule.

Methods

As a CSSRule, CSSKeyframesRule also implements the methods of that interface. It has three specific methods:

CSSKeyframesRule.appendRule()
Inserts a new keyframe rule into the current CSSKeyframesRule. The parameter is a 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()
Deletes a keyframe rule from the current CSSKeyframesRule. The parameter is the index of the keyframe to be deleted, expressed as a DOMString resolving as a number between 0% and 100%.
CSSKeyframesRule.findRule()
Returns a keyframe rule corresponding to the given key. The key is a DOMString containing an index of the keyframe to be returned, resolving to a percentage between 0% and 100%. If no such keyframe exists, findRule returns null.

Specification

Specification Status Comment
CSS Animations
The definition of 'CSSKeyframesRule' in that specification.
Working Draft Initial definition

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes 48
48
5
Prefixed
Prefixed Requires the vendor prefix: moz
10 12
Prefixed
12
Prefixed
Prefixed Requires the vendor prefix: -o
4
appendRule Yes
Yes
? — 45
Uses the non-standard name: insertRule
? 22
22
5 — 22
Uses the non-standard name: insertRule
10
10
Uses the non-standard name: insertRule
Yes
Yes
Uses the non-standard name: insertRule
Yes
Yes
Uses the non-standard name: insertRule
cssRules ? ? ? ? ? ?
deleteRule ? ? ? ? ? ?
findRule ? ? ? ? ? ?
name ? ? ? ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes 48
48
5
Prefixed
Prefixed Requires the vendor prefix: moz
12
Prefixed
12
Prefixed
Prefixed Requires the vendor prefix: -o
Yes ?
appendRule Yes
Yes
? — 45
Uses the non-standard name: insertRule
Yes
Yes
? — 45
Uses the non-standard name: insertRule
? 22
22
5 — 22
Uses the non-standard name: insertRule
Yes
Yes
Uses the non-standard name: insertRule
Yes
Yes
Uses the non-standard name: insertRule
?
cssRules ? ? ? ? ? ? ?
deleteRule ? ? ? ? ? ? ?
findRule ? ? ? ? ? ? ?
name ? ? ? ? ? ? ?

See also

© 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