The document discusses techniques for making SVG graphics responsive. It describes using media queries directly in SVG code to serve different background images based on viewport width. It also covers embedding SVG using inline, <img>, and <object> tags and their tradeoffs. The "Clown Car Technique" embeds the SVG as an <object> and uses media queries inside the SVG to switch background images. The "Poor Man's Method" defines all icon variants inside the SVG and shows/hides them with media queries. The "Man With A Gun's Method" uses transforms to adapt a single SVG to different sizes. JavaScript can also be added to SVG to make it more dynamic and responsive.
60. @media only screen and (min-width: 65em)
and (min-height:40em) {
!
.icon {background-position: center -2400px;}
!
}
Responsive Icons (SVG)
61. @media only screen and (min-width: 60em)
and (min-height:37em) {
!
.icon {background-position: center -2100px;}
!
}
@media only screen and (min-width: 55em)
and (min-height:33em) {
!
.icon {background-position: center -1800px;}
!
}
Responsive Icons (SVG)
62. Drawbacks
• External CSS
• 8 different illustrations
• Can we make something more
efficient than this technique
from 90s?
63. So…
• SVG can contain styles inside
• SVG supports media-queries
• SVG can react to the parent container size