I'm looking to add a stylish hover effect to an image I created. The goal is to show text when the mouse hovers over the image, but I also want to include a background to enhance readability.
Below is the HTML code:
<div class="portfolio-frame">
<div class="portfolio-overflow-hidden">
<img width="420" height="236" src="http://benjaminbinauld.lfdb.fr/files/2013/03/mire-servitel16-9.jpg" />
<div class="portfolio-overlay">
<span class="text-overlay">Click here boy !</span>
</div>
</div>
</div>
And the CSS code:
.portfolio-frame {
height: 94px;
width: 165px;
margin-left: 10px;
margin-top: 46px;
z-index:1;
}
.portfolio-overflow-hidden {
height: 94px;
width: 165px;
}
.portfolio-overlay .text-overlay {
display: none;
}
.portfolio-frame:hover .portfolio-overlay {
display:block;
position:inherit;
z-index:999;
background-color: #000;
}
.portfolio-frame:hover .text-overlay {
display:block;
z-index:999;
text-transform: uppercase;
font-weight: bold;
color: #fff;
margin-top: -45px;
}
You can view the live version here: http://jsfiddle.net/fzKe7/