Skip to content

Instantly share code, notes, and snippets.

@s4y
Created February 7, 2015 22:53
Show Gist options
  • Save s4y/75a3c210da7dd8e1574d to your computer and use it in GitHub Desktop.
Save s4y/75a3c210da7dd8e1574d to your computer and use it in GitHub Desktop.
Covered button
<!DOCTYPE html>
<style>
html {
font: 18px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.covered {
position: relative;
overflow: hidden;
width: 200px;
height: 50px;
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}
.covered > .under, .covered > .over {
text-align: center;
line-height: 50px;
position: absolute;
top: 0; right: 0; left: 0;
height: 100%;
transition: top 0.25s, background 0.25s;
}
.covered > .over {
color: white;
background: rgb(97, 129, 255);
}
.covered:not(:hover) > .under {
top: -25%;
background: rgba(0, 0, 0, 0.2);
}
.covered:hover > .over {
top: 100%;
bottom: -100%;
}
</style>
<div class=covered>
<div class=under>Yay!</div>
<div class=over>I'm a button</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment