Positioning HTML5 SVG in the center of screen

JavascriptWeb DevelopmentFront End Scripts

To center SVG, add the following CSS:

# svgelem {
   margin-left:auto;
   margin-right:auto;
   display:block;
}

The following is our SVG:

<svg id="svgelem" height="200" xmlns="http://www.w3.org/2000/svg">
   <circle id="redcircle" cx="50" cy="50" r="50" fill="red" />
</svg>
raja
Published on 11-Apr-2018 12:10:35
Advertisements