layer()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.

The layer() CSS function is used along with the @import at-rule to put the imported resource in a separate named cascade layer.

Syntax

css
@import url layer(layer-name);
@import "dark.css" layer(framework.themes.dark);

The framework.themes.dark is the layer into which the CSS file would be imported.

Formal syntax

Error: could not find syntax for this item

Specifications

Specification
CSS Cascading and Inheritance Level 5
# ref-for-typedef-layer-name

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
layer()

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also