Created
February 7, 2015 22:53
-
-
Save s4y/75a3c210da7dd8e1574d to your computer and use it in GitHub Desktop.
Covered button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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