HTML DOM
The media property of the HTMLLinkElement interface is a string representing a list of one or more media formats to which the resource applies.
It reflects the media attribute of the link element.
Value
A string.
Examples
<link
id="el"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
media="screen and (width >= 600px)"
crossorigin="anonymous" />
const el = document.getElementById("el");
console.log(el.media); // Output: "screen and (width >= 600px)"
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
