I'm trying to use the property overflow: visible
on SVG.
It's displaying well but there is an issue :
When I try to put an event on the element that is out of the SVG, it doesn't work. It's like the svg element is behind the other elements.
I've tried to play with z-index
but it doesn't work.
I would rather prefer to don't use the viewBox
in that answer Overflow: Visible on SVG.
Here is the code :
HTML
<p>Blabla</p>
<svg width="100" height='100'>
<circle id='c1' cx='10px' cy='-10px' r='5' onclick='alert("c1")'></circle>
<circle id='c2' cx='10px' cy='10px' r='5' onclick='alert("c2")'></circle>
</svg>
CSS
svg {
overflow: visible;
}
circle {
fill: black;
}
circle:hover {
fill: red;
}
When I click on the first circle that overflows the SVG it's not displaying the alert. But for the one, that is inside the SVG it works.
The problem appears to be only in Chrome. On Firefox and IE it's working.