How Do I Scale an Svg File?
Contents

How do you scale an SVG?

How to resize a SVG image

  1. Change width and height in XML format. Open the SVG file with your text editor. It should show lines of code as below. <svg width=”54px” height=”54px” viewBox=”0 0 54 54″ version=”1.1″ xmlns_xlink=” …
  2. 2 . Use “background-size” Another solution is to use CSS.

How do I fix SVG size?

2 Answers

  1. Give your SVG element a fixed height. If you do not do this the height of the element will change proportional to the width.
  2. Adjust your viewBox to crop to the height of your content.
  3. Fix your preserveAspectRatio value to have the proper case-sensitive value, e.g. xMinYMin (not xMinYmin ).

5.02.2015

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest