| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/CSSKeyframeRule | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since August 2016.
The CSSKeyframeRule interface describes an object representing a set of styles for a given keyframe. It corresponds to the contents of a single keyframe of a @keyframes at-rule.
Inherits properties from its ancestor CSSRule.
CSSKeyframeRule.keyTextRepresents the key of the keyframe, like '10%', '75%'. The from keyword maps to '0%' and the to keyword maps to '100%'.
CSSKeyframeRule.style Read onlyReturns a CSSStyleDeclaration of the CSS style associated with the keyframe.
No specific methods; inherits methods from its ancestor CSSRule.
The CSS includes a keyframes at-rule. This will be the first CSSRule returned by document.styleSheets[0].cssRules.
myRules[0] returns a CSSKeyframesRule object, which will contain individual CSSKeyFrameRule objects for each keyframe.
@keyframes slide-in {
from {
transform: translateX(0%);
}
to {
transform: translateX(100%);
}
}
let myRules = document.styleSheets[0].cssRules;
let keyframes = myRules[0]; // a CSSKeyframesRule
console.log(keyframes[0]); // a CSSKeyframeRule representing an individual keyframe.
| Specification |
|---|
| CSS Animations Level 1 # interface-csskeyframerule |
This page was last modified on Nov 7, 2025 by MDN contributors.
CSSKeyframeRuleCSSCSSConditionRuleCSSFontFeatureValuesMapCSSFontFeatureValuesRuleCSSFontPaletteValuesRuleCSSFunctionDeclarationsCSSFunctionDescriptorsCSSFunctionRuleCSSGroupingRuleCSSImportRuleCSSKeyframesRuleCSSLayerBlockRuleCSSLayerStatementRuleCSSMediaRuleCSSNamespaceRuleCSSPageDescriptorsCSSPageRuleCSSPropertyRuleCSSRuleCSSRuleListCSSStartingStyleRuleCSSStyleDeclarationCSSStylePropertiesCSSStyleRuleCSSStyleSheetCSSSupportsRuleCaretPositionMediaListMediaQueryListScreenStyleSheetStyleSheetListYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |