CSSKeyframesRule

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

CSSKeyframesRule interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contents 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
Represents the name of the animation, used by the animation-name 特性。
CSSKeyframesRule.cssRules 只读
返回 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()
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 采用 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 返回 null .

规范

规范 状态 Comment
CSS Animations
The definition of 'CSSKeyframesRule' in that specification.
工作草案 初始定义

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CSSKeyframesRule
Chrome Yes Edge 12 Firefox 48
48
5
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE 10 Opera 12
Prefixed
12
Prefixed
Prefixed Implemented with the vendor prefix: o
Safari 4 WebView Android Yes Chrome Android Yes Firefox Android 48
48
5
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android 12
Prefixed
12
Prefixed
Prefixed Implemented with the vendor prefix: o
Safari iOS Yes Samsung Internet Android Yes
appendRule
Chrome Yes
Yes
不支持 ? — 45
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Edge 12 Firefox 22
22
不支持 5 — 22
Alternate Name
Alternate Name Uses the non-standard name: insertRule
IE 10
Alternate Name
10
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Opera Yes
Alternate Name
Yes
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Safari Yes
Alternate Name
Yes
Alternate Name
Alternate Name Uses the non-standard name: insertRule
WebView Android Yes
Yes
不支持 ? — 45
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Chrome Android Yes
Yes
不支持 ? — 45
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Firefox Android 22
22
不支持 5 — 22
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Opera Android Yes
Alternate Name
Yes
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Safari iOS Yes
Alternate Name
Yes
Alternate Name
Alternate Name Uses the non-standard name: insertRule
Samsung Internet Android Yes
Yes
不支持 ? — 5.0
Alternate Name
Alternate Name Uses the non-standard name: insertRule
cssRules
Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
deleteRule
Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
findRule
Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
name
Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持
完整支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
使用非标名称。
要求使用供应商前缀或不同名称。
要求使用供应商前缀或不同名称。

另请参阅