CSSImportRule
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
* Some parts of this feature may have varying levels of support.
インスタンスプロパティ
祖先である CSSRule から継承したプロパティがあります。
CSSImportRule.href読取専用-
@importルールで指定された URL を返します。 CSSImportRule.layerName読取専用-
@importルールで宣言されたカスケードレイヤーの名前を返します。レイヤーが無名の場合は空文字列、ルールが何も宣言していない場合はnullを返します。 CSSImportRule.media-
関連づけられたスタイルシートの
media属性の値を返します。 CSSImportRule.styleSheet読取専用-
関連づけられたスタイルシートを返します。
CSSImportRule.supportsText読取専用 Experimental-
@importルールで指定した supports の条件を返します。
インスタンスメソッド
祖先である CSSRule から継承したメソッドがあります。
例
この文書には単一のスタイルシートが記述されており、そのスタイルシートには単一の @import ルールだけが含まれています。したがって、 CSS ルールのリストの最初の項目は CSSImportRule になります。
css
@import url("style.css") screen;
js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // CSSImportRule インスタンスオブジェクト
仕様書
| Specification |
|---|
| CSS Object Model (CSSOM)> # the-cssimportrule-interface> |
ブラウザーの互換性
Loading…