media
åºçº¿
广æ³å¯ç¨
èª 2020å¹´1æ èµ·ï¼æ¤ç¹æ§å·²å¨ä¸»æµæµè§å¨ä¸å¾å°æ¯æï¼å¯å¨å¤§å¤æ°è®¾å¤åæµè§å¨çæ¬ä¸æ£å¸¸ä½¿ç¨ã
media 屿§æå®åªæç¬¦åmedia queryçæ ·å¼è¡¨æä¼è¢«åºç¨ã
åªæä¸ä¸ªå
ç´ ä½¿ç¨è¿ä¸ªå±æ§ï¼ <style>
示ä¾
html
<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.å¦ææ²¡ææå®ï¼æ ·å¼è¡¨å°±ä¼è¢«åºç¨ã
è§è
| è§è |
|---|
| Scalable Vector Graphics (SVG) 2 > # StyleElementMediaAttribute > |