Syntax error Positioning HTML5 SVG in the center of screen

Positioning HTML5 SVG in the center of screen



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>
Updated on: 2020-01-29T10:20:13+05:30

354 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements