CSSImportRule: styleSheet property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("CSSOM")}}

The read-only **styleSheet** property of the {{domxref("CSSImportRule")}} interface returns the CSS Stylesheet specified by the {{cssxref("@import")}} at-rule. This will be in the form of a {{domxref("CSSStyleSheet")}} object.

An {{cssxref("@import")}} at-rule always has an associated stylesheet.

Value

A {{domxref("CSSStyleSheet")}}.

Examples

The following stylesheet includes a single {{cssxref("@import")}} rule. Therefore the first item in the list of CSS rules will be a CSSImportRule. The styleSheet property returns the imported stylesheet.

css
@import "style.css" screen;
js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].styleSheet); // A CSSStyleSheet

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}