Skip to content

Instantly share code, notes, and snippets.

@dziudek
Created March 15, 2012 09:38
Show Gist options
  • Save dziudek/2043286 to your computer and use it in GitHub Desktop.
Save dziudek/2043286 to your computer and use it in GitHub Desktop.
:hover overlay effect with using :after instead of additional element
/**
* :hover overlay effect with using :after instead of additional element
**/
body > div {
width: 100px;
height: 100px;
background: #eee;
margin: 100px;
}
body > div:after {
content: "Preview";
width:100px;
height:100px;
display:block;
background: #ff0;
text-align:center;
line-height:100px;
opacity:0;
transition: all 0.5s linear;
}
body > div:hover:after {
opacity: 1.0;
}
<!-- content to be placed inside <body>…</body> -->
<div></div>
{"view":"split","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment