How to use z-index in svg elements?

I’m using the svg circles in my project like this,

<svg xmlns="" viewBox="0 0 160 120">
        <g id="one">
            <circle fill="green" cx="100" cy="105" r="20" />
        <g id="two">
            <circle fill="orange" cx="100" cy="95" r="20" />

And I’m using the z-index in the g tag to show the elements the first. In my project I need to use only z-index value, but I can’t use the z-index to my svg elements. I have googled a lot but I didn’t find anything relatively. So please help me to use z-index in my svg.

Here is the DEMO.

Leave a Comment