Skip to content Skip to sidebar Skip to footer

How Can I Resize An Svg?

I have code like this: viewBox attribute, like so:

<svgviewBox="0 0 32 32"height="100"width="100"...>

The viewBox attribute establishes the coordinate system that is used for all the child elements of the SVG. You can then use the width and height to stretch this coordinate system to the desired size.

You can use the preserveAspectRatio attribute to decide how to scale if the aspect ratios don't match.

Solution 2:

It worked for me by modifying the svg style

let svgDom = document.getElementsByTagName("svg")[0];
let newWidth=100,newHeight=90;
svgDom.style.width = newWidth+'px';
svgDom.style.height = newHeight+'px';

Solution 3:

just throw a transform="scale(2)" and it will do the trick, ( React )

<svgwidth={56}height={56}transform="scale(2)"fill="none"xmlns="http://www.w3.org/2000/svg"
  {...props}
><circlecx={28}cy={28}r={24}fill="#F88423" /><pathfillRule="evenodd"clipRule="evenodd"d="..."fill="#131903"
  /></svg>

Post a Comment for "How Can I Resize An Svg?"