CSSImportRule: thuộc tính styleSheet
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.
Thuộc tính chỉ đọc styleSheet của giao diện CSSImportRule trả về Bảng kiểu CSS được chỉ định bởi quy tắc điều kiện @import. Đây sẽ là một đối tượng CSSStyleSheet.
Một quy tắc điều kiện @import luôn có một bảng kiểu liên kết.
Giá trị
Một CSSStyleSheet.
Ví dụ
Bảng kiểu sau đây bao gồm một quy tắc @import duy nhất. Do đó, mục đầu tiên trong danh sách các quy tắc CSS sẽ là một CSSImportRule. Thuộc tính styleSheet trả về bảng kiểu được nhập.
css
@import "style.css" screen;
js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].styleSheet); // Một CSSStyleSheet
Đặc tả kỹ thuật
| Specification |
|---|
| CSS Object Model (CSSOM)> # dom-cssimportrule-stylesheet> |