MDN self-hosted library · e01.org

HTMLStyleElement: media property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<style id="inline-style" media="screen, print">
  p {
    color: blue;
  }
</style>
js
const style = document.getElementById("inline-style");

console.log(style.media); // 'screen, print'