CSSImportRule: styleSheet-Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die schreibgeschützte styleSheet-Eigenschaft der CSSImportRule-Schnittstelle gibt das durch die @import-@-Regel spezifizierte CSS-Stylesheet zurück. Dieses wird in Form eines CSSStyleSheet-Objekts bereitgestellt.

Eine @import-@-Regel hat immer ein zugeordnetes Stylesheet.

Wert

Beispiele

Das folgende Stylesheet enthält eine einzelne @import-Regel. Daher wird das erste Element in der Liste der CSS-Regeln eine CSSImportRule sein. Die styleSheet-Eigenschaft gibt das importierte Stylesheet zurück.

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

Spezifikationen

Specification
CSS Object Model (CSSOM)
# dom-cssimportrule-stylesheet

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
styleSheet

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support