html:
<img src="logo.svg" alt="Logo" class="logo-img">
css:
.logo-img path:hover {fill: red;}
Is there a way to change a the hex code on a img svg on hover?
html:
<img src="logo.svg" alt="Logo" class="logo-img">
css:
.logo-img path:hover {fill: red;}
Is there a way to change a the hex code on a img svg on hover?
I don't think you can do that using CSS only, but you could do it with a bit of JavaScript, if you can change the HTML.
Something like:
onmouseover="this.src='newSrcHover.jpg';"
Or you can change the background-image: url('linkToNewImage')
property on :hover
... while that does change an image on hover and may be sufficient for some, it's not src. The JS one is.
An svg in a src attribute is loaded as a file, so it won't be editable.
If you intend to modify fill, stroke and so on, you should use your logo.svg
in an <svg>
tag instead of an <img />
.