+ 1

THE PATH ELEMENT (SVG)

How do I place an object drawn with the path element to the center of the page. Is it appropriate to make use of the <p = align “center”> tag? Here’s a the code..... <svg width="500" height="500"> <path d="M 0 0 L200 200 L200 50 Z" style="stroke:#000; fill:none;" /> </svg>

26th Jan 2018, 1:49 PM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
4 odpowiedzi
+ 2
<!DOCTYPE html> <html> <head> <title>Example code for James Abirola Bisiriu</title> </head> <body style="text-align:center;"> <svg height="500" width="500"> <path d="M 0 0 L 200 200 L 200 50 Z" stroke="#000" fill="none"></path> </svg> </body> </html> The question is what if I have lots code and I want just the contents of the SVG to be centralized in the page, how do I code that, seeing this code makes all the contents of the page to be centralized.
26th Jan 2018, 2:21 PM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
0
Do you mean text-align:center? Then it would fit if you set the svg's parent element to text-align:center.
26th Jan 2018, 1:51 PM
Draphar
0
It doesn’t seem to work, could write it out as a working code maybe it could help
26th Jan 2018, 1:57 PM
James Abiola Bisiriu
James Abiola Bisiriu - avatar
26th Jan 2018, 2:06 PM
Draphar