+ 8

What is the use of width and height attributes of svg tag?

<svg width="400" height="410"> <line x1="10" y1="10" x2="200" y2="100" style="stroke:#000000; stroke-linecap:round; stroke-width:20" /> </svg> I have changed the value of width and height but nothing changed in the result so why will we use them?

30th May 2017, 11:03 AM
Abhijeet Ranjan
Abhijeet Ranjan - avatar
2 odpowiedzi
+ 5
height and width defines the area in which line is drawing modify the code width=100% height=100% and also points i.e value of x2 and y2 and see the difference
30th May 2017, 11:18 AM
Player
Player - avatar
0
Some browsers also have problems in displaying the image when only one dimension is set. Be safe and always set width AND height.
5th Jun 2017, 9:34 PM
Pascal Aoms artofmyself.com
Pascal Aoms artofmyself.com - avatar