Last active
September 30, 2015 04:08
-
-
Save AntonTrollback/1719291 to your computer and use it in GitHub Desktop.
Expanding border - http://jsfiddle.net/AntonTrollback/tB5R8/
This file contains hidden or 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
/* | |
* Expanding border | |
* Inspired by Scorekeeper - youtu.be/sXqXpwyBI1k | |
*/ | |
.btn { | |
position: relative; | |
display: block; | |
width: 100px; | |
height: 100px; | |
margin: 130px auto; | |
border-radius: 3px; | |
color: #666; | |
font: bold 40px/100px sans-serif; | |
text-align: center; | |
text-decoration: none; | |
background: #f1f1f1; | |
user-select: none; | |
} | |
/* Why not a pseudo-element? http://bit.ly/xkO4dn */ | |
.btn .btn-effect { | |
content: ''; | |
position: absolute; | |
top: 0; | |
left: 0; | |
box-sizing: border-box; | |
display: block; | |
width: 100%; | |
height: 100%; | |
border: 3px solid transparent; | |
border-radius: 3px; | |
opacity: 1; | |
} | |
.btn:active { | |
background: #fff; | |
} | |
.btn:active .btn-effect { | |
display: block; | |
opacity: 0; | |
border-color: #fff; | |
-webkit-transform: scale(1.3); | |
-moz-transform: scale(1.3); | |
-ms-transform: scale(1.3); | |
transform: scale(1.3); | |
-webkit-transition: .5s ease-out; | |
-moz-transition: .5s ease-out; | |
-ms-transition: .5s ease-out; | |
transition: .5s ease-out; | |
-webkit-transition-property: transform, opacity; | |
-moz-transition-property: transform, opacity; | |
-ms-transition-property: transform, opacity; | |
transition-property: transform, opacity; | |
} | |
/* Demo styles */ | |
body { | |
background: #222; | |
} | |
.btn:before { | |
content:'click and hold :('; | |
position: absolute; | |
top: -100px; | |
left: -50%; | |
z-index: 10; | |
width: 200%; | |
color: #bbb; | |
font-size: 16px; | |
text-align: center; | |
} |
This file contains hidden or 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
<a href="#" class="btn">✔<span class="btn-effect"></span></a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment