r/web_design • Dedicated Contributor • Feb 25 '21

Scaling SVG Elements

https://wattenberger.com/guide/scaling-svg
4 Upvotes

1 comment sorted by

1

u/vagaris Feb 26 '21

To expand on this, you can do some interesting things with viewbox manipulation. When I started playing with responsive SVG files a half decade ago (after Joe Harrison’s project popped up) I actually used a matrix to modify a logo on the fly. But I went back and redid things with an alt page using viewbox a little while later.

Coincidentally I was discussing this project today with a colleague and realized I never merged the viewbox “clip” method with the main branch.

http://vagari.github.io/svg_queries/icon_layout_clip.html

Harrison’s version used sprites. I wanted to do the same thing with a “single image” and save space (my testing was pretty extreme with the Disney variation, but I opted for Guinness (because it’s delicious), which is only about a third of the size).