Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.
The read-only layerName property of the CSSImportRule interface returns the name of the cascade layer created by the @import at-rule.
If the created layer is anonymous, the string is empty (""), if no layer has been created, it is the null object.
A string, that can be empty, or the null object.
The document's single stylesheet contains three @import rules. The first declaration imports a stylesheet into a named layer. The second declaration imports a stylesheet into an anonymous layer. The third declaration imports a stylesheet without a layer declaration.
The layerName property returns the name of the layer associated with the imported stylesheet.
| CSS Object Model (CSSOM) # dom-cssimportrule-layername |
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.