+ 1

Can you put an html svg rect under a circle in code?

svg properties: I tried to edit the code in HTML study, and it didn't work for me. I had one SVG rect element and then I closed that one with all of its attributes and that I opened up another one and I use the same location for the X and the Y. It only put the 2nd one below it. I want to make them go on top of each other so that the rectangles in the back of the circle is over top of it and then I even wanted to do a triangle as a third one with the poly to get that, but I don't can't even make to work. Any help? Update: I don't have the code. I simply want a rectangle at 25,25 and a circle over it the same color at 50,25. I had the code in the example, then erased it, but I just added a second svg element with those coords, but only 1 showed up, the 1st.

5th Nov 2018, 11:16 PM
Vilanne Chalice
5 Answers
+ 2
You most certainly can. The code would look something like this: <!DOCTYPE html> <html> <head> <title>Overlaying SVG objects</title> </head> <body> <svg width="400" height="400"> <circle cx="200" cy="200" r="50" stroke="black" fill="none" /> <rect width="40" height="40" x="180" y="180" stroke="black" fill="none" /> </svg> </body> </html> You can experiment with the styles, positions and dimensions. You can also add more objects.
6th Nov 2018, 2:36 AM
Josh M.
Josh M. - avatar
+ 2
Here is an example of your query https://code.sololearn.com/WeXwnVT14xez/?ref=app
6th Nov 2018, 5:45 AM
BroFar
BroFar - avatar
+ 2
Excellent code, Josh M. and BroFarOps! Thanks.
11th Dec 2018, 10:43 PM
Vilanne Chalice
+ 2
11th Dec 2018, 11:27 PM
BroFar
BroFar - avatar
+ 1
its very hard to visualize words ya know,a code sample would help better
5th Nov 2018, 11:27 PM
᠌᠌Code X
᠌᠌Code X - avatar