what actually width and height indicates in SVG | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

what actually width and height indicates in SVG

<svg width="2000" height="2000"> <circle cx="80" cy="80" r="50" fill="green" /> </svg> when i change svg width and height again it give sameresults why?

6th Jan 2019, 9:26 PM
Wasiq Abdullah
3 Respostas
+ 4
In the ā€œrealā€ world, before you draw something you get a piece of paper. Well, <svg width="2000" height="2000"> creates an ā€œimaginaryā€ piece of paper that is 2000 units wide, by 2000 units high. And then you draw a circle, somewhere on your paper. Where exactly you place the circle, how ā€œbigā€ is your circle and what ā€œit looks likeā€, is given by the next line: <circle cx="80" cy="80" r="50" fill="green" /> Your circle has a radius of 50 units, its centre is located 80 units to the right from the left edge of your paper, and 80 units below from the upper edge of your paper. And it is all green. As long as you draw the circle inside the ā€œimaginaryā€ paper you have created, you donā€™t see any easily visible difference ā€“ itā€™s only the ā€œbig pictureā€ that changes (i.e. where in relation to the whole area of the paper the circle is placed). But if you set width=ā€100ā€, height=ā€100ā€, then you will find out that the circle is incomplete ā€“ just because your ā€œpaperā€ is too small for the circle you want to draw, where you want to draw it. And this time, you have a difference that is easily visible. Hope this helps.
6th Jan 2019, 10:26 PM
Triantaphyllos Samaras
Triantaphyllos Samaras - avatar
6th Jan 2019, 10:17 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
The width and height attributes of the <svg> element define the width and height of the SVG image.
6th Jan 2019, 10:12 PM
Ulisses Cruz
Ulisses Cruz - avatar