Created
August 24, 2022 13:26
-
-
Save LaunchedBerry07/cf58418663aa447111f555c435e11412 to your computer and use it in GitHub Desktop.
Animated Rainbow 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
<a href="#" class="rainbow-button" alt="Button"></a> |
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
body { | |
margin:0; | |
background-color:#191919; | |
min-height:100vh; | |
display:flex; | |
align-items:center; | |
justify-content:center; | |
font-family:Helvetica,Sans-serif; | |
} | |
a { | |
text-decoration:none; | |
color:#FFF; | |
} | |
.rainbow-button { | |
width:calc(20vw + 6px); | |
height:calc(8vw + 6px); | |
background-image: linear-gradient(90deg, #00C0FF 0%, #FFCF00 49%, #FC4F4F 80%, #00C0FF 100%); | |
border-radius:5px; | |
display:flex; | |
align-items:center; | |
justify-content:center; | |
text-transform:uppercase; | |
font-size:3vw; | |
font-weight:bold; | |
} | |
.rainbow-button:after { | |
content:attr(alt); | |
width:20vw; | |
height:8vw; | |
background-color:#191919; | |
display:flex; | |
align-items:center; | |
justify-content:center; | |
} | |
.rainbow-button:hover { | |
animation:slidebg 2s linear infinite; | |
} | |
@keyframes slidebg { | |
to { | |
background-position:20vw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment