Get to know MDN better
Since December 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The CSSNestedDeclarations interface of the CSS Rule API is used to group nested CSSRules.
The interface allows the CSS Object Model (CSSOM to mirror the structure of CSS documents with nested CSS rules, and ensure that rules are parsed and evaluated in the order that they are declared.
Note: Implementations that do not support this interface may parse nested rules in the wrong order. See Browser compatibility for more information.
Inherits properties from its ancestor CSSRule.
CSSNestedDeclarations.style Read onlyReturns the values of the nested rules.
No specific methods; inherits methods from its ancestor CSSRule.
The CSS below includes a selector .foo that contains two declarations and a media query.
This is represented by a number of JavaScript objects in the CSS Object Model:
Note: All top-level styles after the first CSSNestedDeclaration must also be represented as CSSNestedDeclaration objects in order to follow the CSS nested declarations rule
| CSS Nesting Module Level 1 # cssnesteddeclarations |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Nov 7, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.