Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Social 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.


<div id="facebook_swap">                              
                    <img src="img/facebook_dark.png" alt="facebook">




    #facebook_swap img:hover{ 


4 Answers

Kevin Korte
Kevin Korte
28,109 Points

ohh, 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
Kevin Korte
28,109 Points

Try removing the space between the url and the parenthesis in the CSS.

Their actually isn't one. It just looks like that in here.

You were right. I must have spelled the file wrong. hahaha Thanks.

Kevin Korte
Kevin Korte
28,109 Points

Been there, got that t-shirt :) Glad to hear it.