How to draw ellipses on top of each other in HTML5 SVG?

HTMLWeb DevelopmentFront End Technology

SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML and the XML is then rendered by an SVG viewer. Most of the web browsers can display SVG just like they can display PNG, GIF, and JPG.

To draw an ellipse in HTML SVG, use the SVG <ellipse> element. For drawing ellipses on top of each other, set the coordinates properly.


You can try to run the following code to learn how to draw two ellipses on top of each other in HTML5 SVG.

<!DOCTYPE html>
         #svgelem {
            position: relative;
            left: 20%;
            -webkit-transform: translateX(-20%);
            -ms-transform: translateX(-20%);
            transform: translateX(-20%);
      <title>HTML5 SVG Ellipse</title>

      <h2>HTML5 SVG Ellipse</h2>
      <svg id="svgelem" width="500" height="200" xmlns="">
         <ellipse cx="240" cy="100" rx="220" ry="30" style="fill:green" />
         <ellipse cx="220" cy="70" rx="190" ry="20" style="fill:yellow" />


Updated on 16-Dec-2021 11:42:21