Skip to content

Instantly share code, notes, and snippets.

@nladart
Forked from dgmid/dabblet.css
Created February 20, 2013 20:19
Show Gist options
  • Save nladart/4999193 to your computer and use it in GitHub Desktop.
Save nladart/4999193 to your computer and use it in GitHub Desktop.
Animated HTML5 / CSS3 image caption - Example 3
/**
* Animated HTML5 / CSS3 image caption - Example 3
*/
/* page styles */
body{
background: #fff;
min-height:100%;
}
p {
width: 300px;
margin: 0 auto;
text-align: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
a:link, a:visited {
color: #999;
text-decoration: none;
}
a:hover, a:active {
color: #0080ff;
}
/* image caption styles */
figure {
margin: 100px auto;
width: 200px;
height: 200px;
overflow: hidden;
position: relative;
}
figcaption {
position: absolute; display: block;
width: 350px;
height: 50px;
left: 110px;
bottom: -110px;
text-align: center;
color: #fff;
background-color: rgba(26,54,59,0.8);
border: 3px solid rgba(62,116,126,0.6);
line-height: 50px;
box-shadow: rgba(0,0,0,.5) 0 2px 8px;
transform:rotate(-45deg);
transition: bottom .5s ease-out, left .5s ease-out;
}
figure:hover figcaption {
left: -20px;
bottom: 20px;
}
<body>
<figure>
<img src="http://www.midwinter-dg.com/blog_demos/css3-animated-image-captions/olafsfjordur.png" width="200" height="200" alt="Ólafsfjörður" />
<figcaption>Ólafsfjörður</figcaption>
</figure>
<p>you can find more examples here:<br />
<a href="http://www.midwinter-dg.com/blog_demos/css3-animated-image-captions/" target="_blank">css3 animated image captions</a></p>
</body>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment