Skip to content

Instantly share code, notes, and snippets.

@gunnarbittersmann
Created August 16, 2014 18:01
Show Gist options
  • Select an option

  • Save gunnarbittersmann/6a67390643dec72bdb94 to your computer and use it in GitHub Desktop.

Select an option

Save gunnarbittersmann/6a67390643dec72bdb94 to your computer and use it in GitHub Desktop.
figure caption disappears
/**
* figure caption disappears
*/
html
{
background: hsl(30, 60%, 90%);
}
figure
{
display: inline-block;
position: relative;
width: 24em;
}
img
{
display: block;
width: 100%;
}
figcaption
{
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 0.5em 1em;
background: hsla(30, 60%, 90%, 0.8);
clip: rect(0, auto, auto, auto);
transition: clip 1s ease-in-out 0s;
}
figure:hover figcaption
{
clip: rect(100vh, auto, auto, auto);
}
figcaption span
{
font: 1.5em/1.5 Georgia;
display: block;
}
.name
{
font-weight: bold;
}
<figure>
<img src="http://upload.wikimedia.org/wikipedia/commons/3/38/Leonardo_da_Vinci_-_presumed_self-portrait_-_WGA12798.jpg" alt=""/>
<figcaption>
<span class="name">Leonardo da Vinci</span>
<span class="title">Künstler und Wissenschaftler</span>
</figcaption>
</figure>
// alert('Hello world!');
{"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