I read somewhere that CSS and SVG do not go together, but CSS clearly works with SVG. Take a look at this example:
<html>
<head>
<style>
rect:hover{
opacity: 0.5;
}
</style>
</head>
<body>
<svg>
<rect width="300" height="100" style="fill:#d64526" />
</svg>
</body>
</html>
This works, but if I changed the CSS element to this:
rect:hover{
fill: blue;
}
Color will not change on hover. What's happening? Does it partially work?
source
share