On my page I'm using the img tag to embed SVG images. Now I wanted to apply some css onto them. This works well as long as you copypaste the SVG source code directly into your page. However, if I embed them using the img src attribute, it doesn't.
Is there a way to make that work?
<style type="text/css">
path:hover {
fill:white;
}
</style>
<img src="my.svg" />
Thanks in advance!
Well it can be achieved through
JQuery
( Work Around ) , thisJquery
function will convert<img>
tag that hold current svg image into a<svg>
inline tags, you can view it in your browser debugger.In short it will mimic as if directly inserted the SVG image.I do not think this is possible. You are correct in that using inline-SVG will allow you to manipulate the parts of the svg, but including it in an
img
tag will not. See http://css-tricks.com/using-svg/