最佳答案
I'm including an SVG image file on my page within an object
tag, like this:
<object type="image/svg+xml" data="linkto/image.svg">
<!-- fallback image in CSS -->
</object>
The image in question is a world map, i want to transition the fill
property when the mouse hovers over a group
, in this case I've grouped my SVG by continent, so South America looks something like this:
<g id="south_america">
<path fill="#FAFAFA" d="(edited for brevity)"/>
</g>
I can get the fill
property to change on hover by using the following CSS at the top of my SVG document:
<style>
#south_america path {
transition: fill .4s ease;
}
#south_america:hover path {
fill:white;
}
</style>
But I can't get the fill
colour to fade in with a CSS transition, the colour just changes instantly, can anyone shed light on this please?