I've been searching through the site for an answer, and it seems no one has really received a definitive answer for this specific question.
I'm looking to change the color of the stroke on an SVG icon that I made when it is hovered over.
Here is my current code:
<object data="price.svg" type="image/svg+xml" class="icon">
<a href="price.svg" />
</object>
CSS:
.icon {width:100%}
You can't change the properties of a foreign object that way. But it's easy if you can embed the SVG in the HTML file. Then you could reference the IDs of your SVG and change the style of the child elements.
Replace
<object data="price.svg" ...> ... </object>
with the contents of your SVG file:
<svg ...><path id="styled-element" ...></svg>
Now you can apply a style to it:
#styled-element:hover { stroke:red }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With