1. Web
  2. Web-APIs
  3. CSSLayerBlockRule

Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

CSSLayerBlockRule

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨März 2022⁩.

Der CSSLayerBlockRule stellt eine @layer Blockregel dar.

CSSRule CSSGroupingRule CSSLayerBlockRule

Instanz-Eigenschaften

Erbt Eigenschaften von seinen Vorfahren CSSGroupingRule und CSSRule.

CSSLayerBlockRule.name Schreibgeschützt

Ein String, der den Namen der zugehörigen Kaskadenschicht enthält.

Instanz-Methoden

Erbt Methoden von seinen Vorfahren CSSGroupingRule und CSSRule.

Beispiele

HTML

html
<p>I am displayed in <code>color: rebeccapurple</code>.</p>

CSS

css
@layer special {
 p {
 color: rebeccapurple;
 }
}

JavaScript

js
const item = document.getElementsByTagName("p")[0];
const rules = document.styleSheets[1].cssRules;
// Note that stylesheet #1 is the stylesheet associated with this embedded example,
// while stylesheet #0 is the stylesheet associated with the whole MDN page
const layer = rules[0]; // A CSSLayerBlockRule
item.textContent = `The CSSLayerBlockRule is for the "${layer.name}" layer`;

Ergebnis

Spezifikationen

Specification
CSS Cascading and Inheritance Level 5
# csslayerblockrule

Browser-Kompatibilität

Siehe auch

Help improve MDN

Learn how to contribute Diese Seite wurde automatisch aus dem Englischen übersetzt.

AltStyle によって変換されたページ (->オリジナル) /