Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Shon Levi
6,036 PointsHow to change img src="image.svg" (not inline svg) fill?
I want to make button with icon that I create in svg I have file of the icon.svg
My problem is that when I inline svg - it going out of my button (button is responsive and svg icon is something 500x500)
So I make img src="icon.svg" and it now getting to the 100% auto - responsive
BUT
I need to change the fill color of the svg when hovering the button - how can I change external file???
regular css not work for it - maybe something in js?
3 Answers

Shon Levi
6,036 Pointsmy HTML
<img class="svg" src="icon.svg" alt="" />
my CSS
img.svg { fill: #b9c9d4; }
not working

Cindy Lea
Courses Plus Student 6,497 PointsHave you tried a hover property to add it?

Cindy Lea
Courses Plus Student 6,497 PointsHeres another example that also lets you try it out:
Cindy Lea
Courses Plus Student 6,497 PointsCindy Lea
Courses Plus Student 6,497 PointsI was thinking more in the lines of this: (you will need to customize)