HELP WITH SVG | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HELP WITH SVG

What is the maximum pixel value I can use for width and height for a shape I want to create? Help appreciated :)

20th Jan 2017, 3:53 PM
Nene22
Nene22 - avatar
2 Answers
+ 2
With SVG you don't have anymore 'pixels', because you handle vectors, in another specific coordinate system for SVG elements. So, you must deal with 'contentBox' and 'viewBox' to do conversions between each coordinates system ^^ The 'viewport' is the visible part of an SVG ( in essence extensible, so it may be as big as we want, and we can decide if one part only is visible ) It is defined by attributes 'width' and 'height' of <svg> html tag element. If not defined, you cannot be sure of the default size. If you use JS, you can set up the value dynamicaly, reading the size of the <svg> tag in 'pixels' coordinates system, to avoid handle conversions... For more informations, dive into MDN or W3Schools references ;)
20th Jan 2017, 5:38 PM
visph
visph - avatar
0
Pixels lol thanks so much! Will definitely try it am a newbie to coding. :) Hoping to get the hang of this!
20th Jan 2017, 5:52 PM
Nene22
Nene22 - avatar