CSSImportRule.stylesheet

The read-only styleSheet property of the CSSImportRule interface returns the CSS Stylesheet specified by the @import at-rule. This will be in the form of a CSSStyleSheet object.

An @import at-rule always has an associated stylesheet.

Syntax

var href = CSSImportRule.styleSheet;

Value

A CSSStyleSheet.

Examples

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

@import url("style.css") screen;
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].styleSheet); //returns a CSSStyleSheet object

Specifications

Specification Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSImportRule.styleSheet' in that specification.
Working Draft No changes from Document Object Model (DOM) Level 2 Style Specification
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSImportRule' in that specification.
Obsolete Initial definition

Browser compatibility

BCD tables only load in the browser