Skip to content

Instantly share code, notes, and snippets.

@pixleight
Created May 8, 2012 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixleight/2636665 to your computer and use it in GitHub Desktop.
Save pixleight/2636665 to your computer and use it in GitHub Desktop.
Image titles
/**
* Image titles
*/
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300);
html{
background: #EFE;
background: linear-gradient(45deg, #EFE, EEF);
min-height: 100%;
font-family: "Open Sans", sans-serif;
font-weight: 300;
}
#wrapper {
width: 90%;
min-width: 800px;
max-width: 1500px;
margin: 20px auto;
}
a {
position: relative;
z-index: 1;
display: block;
}
a:before {
display: block;
height: 0;
content: attr(title);
padding: 10px;
}
a:hover:before {
height: auto;
display:block;
position: absolute;
z-index: 2;
width: 100%;
padding: 10px;
color: #FFF;
background: rgba(0, 0, 0, 0.5);
}
<div id="wrapper">
<h1>Hello World</h1>
<p>Lorem ipsum dolor sit amet</p>
<a title="Kitten!"><img src="http://placekitten.com/400/300" alt="Kitten!" title="Here is a fuzzy kitten for your enjoyment"></a>
</div>
{"view":"split","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