A Pen by Sebastian Rothbucher on CodePen.
Last active
October 20, 2018 13:50
-
-
Save sebastianrothbucher/5ef26f1f8adaedad81d01121f275a223 to your computer and use it in GitHub Desktop.
glowing button
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
<button class="bt" onclick="alert('whatever')">Hey there</button> |
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
body { | |
background: grey; | |
} | |
.bt { | |
-webkit-appearance: none; | |
-moz-appearance: none; | |
-ms-appearance: none; | |
appearance: none; | |
-webkit-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
padding: 0; | |
display: inline-block; | |
position: relative; | |
border: 0; | |
background: none; | |
color: white; | |
padding: 8px; | |
font-size: 1.2em; | |
overflow: hidden; | |
&::before { // per se out, comes in during hover | |
display: block; | |
content: ' '; | |
position: absolute; | |
top: 0; | |
left: -100%; | |
height: 100%; | |
height: calc(100% - 3px); | |
width: 100%; | |
z-index: -1; | |
background: linear-gradient(90deg, lighten(#38AECC, 15%) 60%, darken(#38AECC, 5%)); // thanks, coolors.co | |
border: 0; | |
border-bottom: 3px solid #044389; // again | |
border-radius: 1px 0 0 1px; | |
transition: left 0.1s; | |
} | |
&:hover::before { // coming in | |
border-radius: 1px; | |
left: 0; | |
} | |
&::after { // per se in, going out during hover ()could consolidate, but so what now) | |
display: block; | |
content: ' '; | |
position: absolute; | |
top: 0; | |
left: 0; | |
height: 100%; | |
height: calc(100% - 3px); | |
width: 100%; | |
z-index: -1; | |
background: darken(#38AECC, 5%); // thanks, coolors.co | |
border: 0; | |
border-bottom: 3px transparent; | |
border-radius: 1px; | |
transition: left 0.1s; | |
} | |
&:hover::after { // going out | |
border-radius: 0 1px 1px 0; | |
left: 100%; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment