HTML
<div class="feature" >
<img src="0308_WVenvirophotos1-water-pollutions.jpg"
width="100%" height="100%"/></div>
CSS
.feature{
height:50%;
width: 60%;
float: left;
margin: 0.5%;
-webkit-transition: width 1s, height 1s, -webkit-transform 2s;
transition: width 1s, height 1s, transform 2s;
}
.feature:hover{
width: 800px;
height: 520px;
-webkit-transform: translate(,) ;
transform: translate(,);
}
This code makes the picture larger when hovered. How can I make the text appear on hover as well?
Using the pseudo element :before, you can do something like this:
.feature:hover:before {
content:'Text Goes Here';
font-size:20px;
color:white;
position:absolute;
top:0;
left:0;
}
Essentially, we're adding the text to the element on hover by using the content property of :before .
Checkout a fiddle showing that here: http://jsfiddle.net/34p5xqmL/
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments