SVG: Resizing svg element

Sometimes there is a need to resize svg element by javascript. SVG image with pink background in the following example has initial “Fullsize” dimensions 1920×1080. SVGLength interface and more is described at under letter S with prefix SVG . Initial width and height is resized to 200×100 in this code snippet.

<svg id="svg" width="1920" height="1080" style="background-color:pink" />
  let svg = document.getElementById('svg');
This entry was posted in workday and tagged . Bookmark the permalink.

Leave a Reply