Skip to content

Commit

Permalink
fix(css): add layer() function page (#35508)
Browse files Browse the repository at this point in the history
* fix(css): add layer() function page

* Apply suggestions from code review
  • Loading branch information
OnkarRuikar authored Sep 11, 2024
1 parent eb7a000 commit 0febb03
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions files/en-us/web/css/@import/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ where:
If the browser does not conform to the conditions specified in the _supports-condition_, it may not fetch the linked stylesheet, and even if downloaded through some other path, will not load it.
The syntax of `supports()` is almost identical to that described in {{CSSxRef("@supports")}}, and that topic can be used as a more complete reference.

Use `@import` together with the `layer` keyword or `layer()` function to import external style sheets (from frameworks, widget stylesheets, libraries, etc.) into layers.

## Description

Imported rules must come before all other types of rules, except {{CSSxRef("@charset")}} rules and layer creating [`@layer`](/en-US/docs/Web/CSS/@layer) statements.
Expand Down
41 changes: 41 additions & 0 deletions files/en-us/web/css/@import/layer_function/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: layer()
slug: Web/CSS/@import/layer_function
page-type: css-function
browser-compat: css.at-rules.import.layer
---

{{CSSRef}}

The **`layer()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) is used along with the [`@import`](/en-US/docs/Web/CSS/@import) [at-rule](/en-US/docs/Web/CSS/At-rule) to put the imported resource in a separate named [cascade layer](/en-US/docs/Web/CSS/@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

```plain
layer() = layer( <layer-name> )
<layer-name> =
<ident> [ '.' <ident> ]*
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{CSSxRef("@import")}}
- [CSS cascade and inheritance](/en-US/docs/Web/CSS/CSS_cascade) module

0 comments on commit 0febb03

Please sign in to comment.