docs.rodeo

MDN Web Docs mirror

media

{{SVGRef}} 

The media attribute specifies a media query that must be matched for a style sheet to apply.

You can use this attribute with the following SVG elements:

Example

html,
body,
svg {
  height: 100%;
}
<svg viewBox="0 0 240 220" xmlns="http://www.w3.org/2000/svg">
  <style>
    rect {
      fill: black;
    }
  </style>
  <style media="all and (min-width: 600px)">
    rect {
      fill: seagreen;
    }
  </style>

  <text y="15">Resize the window to see the effect</text>
  <rect y="20" width="200" height="200" />
</svg>

{{EmbedLiveSample("Example", "200", "200")}} 

Usage notes

Value <media-query-list>
Default value all
Animatable No

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

In this article

View on MDN