Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align svg to center of screen [duplicate]

Tags:

html

svg

here is my svg

<svg id="svgMain" align="center" width="500" height="500"></svg> 

But its not aligned to the center.How to align it to the center of the screen.

like image 872
iJade Avatar asked Nov 14 '12 04:11

iJade


2 Answers

Try CSS:

#svgMain {margin-left:auto; margin-right:auto; display:block;}
like image 122
Francis Nepomuceno Avatar answered Nov 04 '22 13:11

Francis Nepomuceno


Include it in a element.

<div text-align="center">
<svg id="svgMain" align="center" width="500" height="500"></svg>
</div>

This should work.

like image 24
Xin Avatar answered Nov 04 '22 14:11

Xin