CSSImportRule: href property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("CSSOM")}}
The read-only **href** property of the {{domxref("CSSImportRule")}} interface returns the URL specified by the {{cssxref("@import")}} at-rule.
The resolved URL will be the [href](/en-US/docs/Web/HTML/Reference/Elements/link#href) attribute of the associated stylesheet.
Value
A string.
Examples
The following stylesheet includes a single {{cssxref("@import")}} rule. Therefore the first item in the list of CSS rules will be a CSSImportRule. The href property returns the URL of the imported stylesheet.
css
@import "style.css" screen;js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].href); // 'style.css'Specifications
{{Specifications}}
Browser compatibility
{{Compat}}