media - SVG 编辑
media
属性指定只有符合media query的样式表才会被应用。
只有一个元素使用这个属性: <style>
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>
Usage notes
Value | <media-query-list> |
---|---|
Default value | all |
Animatable | Yes |
<media-query-list>
This value holds a media query that needs to match in order for the style sheet to be applied.
如果没有指定,样式表就会被应用。
Specifications
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 media | Candidate Recommendation | Changed the value definition from different media types as defined in CSS 2 to <media-query-list> . |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) media | Recommendation | Initial definition |
浏览器兼容性
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论