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
Jason Bean
3,490 PointsImage Rollover - Solid color with text
Would anyone be able to explain to me how to do a rollover like the sample below:
I'm looking to set my portfolio up the same way, but cant seem to figure out his code. Any help would be greatly appreciated. Thanks!
1 Answer
Phillip Gibson
13,805 PointsUsing Chrome's built-in developer tools (or Firebug or IE's developer tools), you can look at the source code and see how they did it.
It looks like an image with a div on top that initially has display: none; set. On hover, it is set to display: block; which will then cover the picture with whatever color and text is defined within that div.
Here is a quick sample I threw together. It uses opacity rather than display to hide the element, but has the same effect.
