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

SVG Rectangle

Rectangle has the tag <rect attributes /> right! Why did they show <rect attributes> <animate /></rect>?

16th Jan 2017, 10:43 PM
Vamsi Mohan Ramineedi
Vamsi Mohan Ramineedi - avatar
4 Answers
+ 3
SVG stands for Scalable Vector Graphics. The course is teaching you to animate not just to draw a rectangle hence the animate tag. Tho probably the svg tag would be more appropriate.
20th Jan 2017, 3:45 PM
Alexander Kunchev
Alexander Kunchev - avatar
+ 3
​Well this particular code they show should work without closing the rect tag because it doesn't need to be closed. However if you want to put another shape in after the animation tag you absolutely need to close the rect tag or the other shape will not be displayed. The reason being it takes anything written after the animation tag as part of the rect if you don't close it.
23rd Jan 2017, 11:58 AM
Alexander Kunchev
Alexander Kunchev - avatar
+ 1
In fact in the first form, 'rect' was used with an end tag, but shortcut form: <rect attributes /> is equivalent to: <rect attributes></rect> meaning that the tag has no child node content ( is empty )... To use an <animate> node applied to the <rect> node, we must put it as child, needing to develop the shortcut form ^^
23rd Jan 2017, 12:13 PM
visph
visph - avatar
0
my question was, why did rect have an end tag?... initially rect was used without an end tag
21st Jan 2017, 2:37 AM
Vamsi Mohan Ramineedi
Vamsi Mohan Ramineedi - avatar