Created
April 21, 2012 17:57
-
-
Save sarukuku/2438830 to your computer and use it in GitHub Desktop.
Image with an on hover fade in-out caption.
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
/** | |
* Image with an on hover fade in-out caption. | |
*/ | |
@import url(http://fonts.googleapis.com/css?family=Oswald); | |
/** | |
* Natural box-model | |
*/ | |
* { | |
-moz-box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
.wrapper { | |
position: relative; | |
width: 100%; | |
max-width: 1024px; | |
margin: 0 auto; | |
overflow: auto; | |
} | |
.featured-box { | |
display: block; | |
float: left; | |
width: 321px; | |
height: 200px; | |
background-color: #BBB; | |
background-image: url(http://lorempixel.com/350/220/); | |
background-position: center; | |
margin: 10px; | |
box-shadow: 0 0 7px #000; | |
text-decoration: none; | |
} | |
.featured-box-overlay { | |
opacity: 0; | |
width: 100%; | |
height: 100%; | |
background-color: rgba(0, 0, 0, 0.6); | |
position: relative; | |
transition: opacity 0.1s ease-in-out; | |
color: white; | |
padding: 15px; | |
} | |
.featured-box-overlay h2 { | |
padding: 0; | |
margin: 0; | |
font-size: 16px; | |
font-family: Oswald, Arial; | |
text-transform: uppercase; | |
} | |
.featured-box-overlay p { | |
font-size: 15px; | |
font-family: Verdana, "Bitstream Vera Sans", sans-serif; | |
} | |
.featured-box-overlay h5 { | |
position: absolute; | |
bottom: 5px; | |
left: 0; | |
width: 100%; | |
text-align: center; | |
padding: 0; | |
margin: 0px; | |
font-family: Oswald, Arial; | |
} | |
.featured-box:hover div.featured-box-overlay { | |
opacity: 1; | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<div class="wrapper"> | |
<a href="#" class="featured-box"> | |
<div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
<a href="#" class="featured-box"> | |
<div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
<a href="#" class="featured-box"> | |
<div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
<a href="#" class="featured-box"> | |
<div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
<a href="#" class="featured-box"> <div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
<a href="#" class="featured-box"> <div class="featured-box-overlay"> | |
<h2>Lorem ipsum dolor</h2> | |
<p>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</p> | |
<h5>- click to read more -</h5> | |
</div> | |
</a> | |
</div> |
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
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment