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!
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

Chris Schweiger
2,195 PointsSocial media icon swapping
Okay I have two images for a facebook icon. One image is a dark color for the normal state and the other is a blue color for when you hover over it. How do I code it so when I hover over the image it switches from the dark to the blue color?
This is what I have so far but all it does is turn the opacity down for the dark image and you don't see the blue image.
Html:
<div id="facebook_swap">
<img src="img/facebook_dark.png" alt="facebook">
</div>
css:
#facebook_swap{
width:32px;
height:32px;
background-image:url("img/facebook_active.png");
}
#facebook_swap img:hover{
opacity:0;
}
4 Answers

Kevin Korte
28,148 Pointsohh, mmmm. And I assume you've triple checked the image name.
Check out this codepen I did using your code as a base, and see if you don't see a difference. I can't figure it out yet. So it must be something small that is causing it to not work.

Kevin Korte
28,148 PointsTry removing the space between the url and the parenthesis in the CSS.

Chris Schweiger
2,195 PointsTheir actually isn't one. It just looks like that in here.

Chris Schweiger
2,195 PointsYou were right. I must have spelled the file wrong. hahaha Thanks.

Kevin Korte
28,148 PointsBeen there, got that t-shirt :) Glad to hear it.