Created
February 2, 2021 04:22
-
-
Save cmlohr/a0cb6e050da6880f6776614f6ef2799d to your computer and use it in GitHub Desktop.
Animated Border Hover 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
<div class="cont-btn-container"> | |
<span class="cont-btn">Learn More</span> | |
</div> |
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
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300&display=swap'); | |
body { | |
margin: 0; | |
padding: 0; | |
background-color: #000; | |
} | |
.cont-btn { | |
cursor: pointer; | |
position: relative; | |
padding: 10px 20px; | |
background: none; | |
color: white; | |
font-family: 'Raleway', sans-serif; | |
font-weight: bold; | |
font-size: 28px; | |
border-top-right-radius: 10px; | |
border-bottom-left-radius: 10px; | |
transition: all 1s; | |
} | |
.cont-btn:after, .cont-btn:before { | |
content: " "; | |
width: 10px; | |
height: 10px; | |
position: absolute; | |
border: 0px solid #fff; | |
transition: all 1s; | |
} | |
.cont-btn:after { | |
top: 4px; | |
left: 4px; | |
border-top: .1em solid rgb(0,230,255); | |
border-left: .1em solid rgb(0,230,255); | |
} | |
.cont-btn:before { | |
bottom: 4px; | |
right: 4px; | |
border-bottom: .1em solid rgb(0,230,255); | |
border-right: .1em solid rgb(0,230,255); | |
} | |
.cont-btn:hover { | |
border-top-right-radius: 0px; | |
border-bottom-left-radius: 0px; | |
color: rgb(0,230,255); | |
} | |
.cont-btn:hover:before, .cont-btn:hover:after { | |
width: 100%; | |
height: 100%; | |
} | |
.cont-btn-container { | |
background: none; | |
height: 100vh; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment