CSSImportRule

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.

* Some parts of this feature may have varying levels of support.

CSSImportRule@import アットルールを表します。

CSSRule CSSImportRule

インスタンスプロパティ

祖先である 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

ブラウザーの互換性

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
CSSImportRule
href
layerName
media
styleSheet
supportsText

Legend

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

Full support
Full support
No support
No support