0

What's the difference between using svg width and height & rect height width bcos when both changed acc to need gvs same result

6th Apr 2017, 5:44 AM
Shreya Parmar
Shreya Parmar - avatar
6 Réponses
+ 8
Try this- <svg style='border:2px solid black;' width="300" height="200"> <rect width="200" height="100" x="20" y="20" fill="green" /> </svg>
6th Apr 2017, 5:50 AM
Sachin Artani
Sachin Artani - avatar
+ 8
Please prefer SVG vs Canvas in HTML course given in SoloLearn.
6th Apr 2017, 5:56 AM
Sachin Artani
Sachin Artani - avatar
+ 6
Don't say canvas, SVG is the area of SVG 😁 and yes, rect is the area of figure.
6th Apr 2017, 5:54 AM
Sachin Artani
Sachin Artani - avatar
+ 3
Both attributes change the size of the HTML item they stand next to. If you set the height/width of svg space and then create a rect larger that this space, any change in size parameters between runs - also because both items are of the same shape which could be confusing - will make you think that there is no difference. In reality there is - either you change the size of an object (rectangle in this case) or the size of the drawing space as a whole (svg). Try to change the object to circle to notice the difference right away :)
6th Apr 2017, 5:57 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Ohk cool so svg is the area of canvas and rect is the area of our figure
6th Apr 2017, 5:53 AM
Shreya Parmar
Shreya Parmar - avatar
0
Ohk m sorry then say me what is canvas
6th Apr 2017, 5:55 AM
Shreya Parmar
Shreya Parmar - avatar