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
Ravi Kaul
1,372 PointsHow to show an image above a link when you hover over it?
Hi I have a link and would like to show a small graphic over it when I hover on it. How can I do this with CSS?
2 Answers
Jason Anders
Treehouse Moderator 145,863 PointsHey Ravi,
The short answer would be with the pseudo-element :hover and the CSS "visibility" property.
Keep Coding! :)
Ravi Kaul
1,372 PointsHi this is how I did it:
- I used background property to show the icon.
- Used this to position it above the text link:
background-repeat: no-repeat; background-position-x: 50%; background-position-y: -10%;
Ravi Kaul
1,372 PointsRavi Kaul
1,372 PointsHi Jason thanks for that, I understand that bit the part which is confusing me is how to show the icon above the link rather than next to it.