files/en-us/web/api/csslayerblockrule/index.md
{{APIRef("CSSOM")}}
The CSSLayerBlockRule represents a {{cssxref("@layer")}} block rule.
{{InheritanceDiagram}}
Inherits properties from its ancestors {{domxref("CSSGroupingRule")}} and {{domxref("CSSRule")}}.
Inherits methods from its ancestors {{domxref("CSSGroupingRule")}} and {{domxref("CSSRule")}}.
<p>I am displayed in <code>color: rebeccapurple</code>.</p>
@layer special {
p {
color: rebeccapurple;
}
}
const item = document.getElementsByTagName("p")[0];
const rules = document.getElementById("css-output").sheet.cssRules;
const layer = rules[0]; // A CSSLayerBlockRule
item.textContent = `The CSSLayerBlockRule is for the "${layer.name}" layer`;
{{EmbedLiveSample("Examples")}}
{{Specifications}}
{{Compat}}