Created
August 12, 2011 20:03
-
-
Save whistler/1142872 to your computer and use it in GitHub Desktop.
Create Onhover Image Caption Using CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* parent div and hover properties */ | |
.imgteaser { | |
margin: 0; | |
overflow: hidden; | |
float: left; | |
position: relative; | |
} | |
.imgteaser a { | |
text-decoration: none; | |
float: left; | |
} | |
.imgteaser a:hover { | |
cursor: pointer; | |
} | |
/* image border */ | |
.imgteaser a img { | |
float: left; | |
margin: 0; | |
border: none; | |
padding: 10px; | |
background: #fff; | |
border: 1px solid #ddd; | |
} | |
/* learn more */ | |
.imgteaser a .more { | |
position: absolute; | |
right: 20px; | |
bottom: 20px; | |
font-size: 1.2em; | |
color: #fff; | |
background: #000; | |
padding: 5px 10px; | |
filter:alpha(opacity=65); | |
opacity:.65; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=65)"; /*--IE 8 Transparency--*/ | |
} | |
.imgteaser a:hover .desc{ | |
display: block; | |
font-size: 1.2em; | |
padding: 10px 0; | |
background: #111; | |
filter:alpha(opacity=75); | |
opacity:.75; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"; /*--IE 8 Transparency--*/ | |
color: #fff; | |
position: absolute; | |
bottom: 11px; | |
left: 11px; | |
padding: 10px; | |
margin: 0; | |
width: 566px; | |
border-top: 1px solid #999; | |
} | |
.imgteaser a:hover .desc strong { | |
display: block; | |
margin-bottom: 5px; | |
font-size:1.5em; | |
} | |
/* hide learn more */ | |
.imgteaser a .desc { display: none; } | |
.imgteaser a:hover .more { visibility: hidden;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="imgteaser"> | |
<a href="#"> | |
<img src="Daim1.jpg" alt="Daim Graffiti" /> | |
<span class="more">» Learn More</span> | |
<span class="desc"> | |
<strong>DAIM 2002</strong> | |
Blandit turpis patria euismod at iaceo appellatio, demoveo esse. Tation utrum utrum abigo demoveo immitto aliquam sino aliquip. | |
</span> | |
</a> | |
</div> | |
source: http://www.sohtanaka.com/web-design/css-on-hover-image-captions/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment