HTMLLinkElement: media-Eigenschaft
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Juli 2015.
Die media-Eigenschaft des HTMLLinkElement-Interfaces ist ein String, der eine Liste von einem oder mehreren Medienformaten darstellt, auf die die Ressource angewendet wird.
Sie spiegelt das media-Attribut des <link>-Elements wider.
Wert
Ein String.
Beispiele
html
<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" /> js
const el = document.getElementById("el"); console.log(el.media); // Output: "screen and (width >= 600px)" Spezifikationen
| Specification |
|---|
| HTML> # dom-link-media> |