Created
February 27, 2024 14:42
-
-
Save pebueno/5eccb691e90f6cb67dc33a8075ff3772 to your computer and use it in GitHub Desktop.
Button Gradient Roll on Hover
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
// Implement animation for gradient on hover | |
const Component = () => { | |
return ( | |
<div className="container"> | |
<button>BUTTON</button> | |
</div> | |
) | |
} | |
ReactDOM.render(<Component />, document.querySelector("#app")) |
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
.container { | |
width: 300px; | |
} | |
button { | |
margin: 50px; | |
width: 300px; | |
height: 50px; | |
border-radius: 20px; | |
border: none; | |
outline: none; | |
background-size: 300% 100%; | |
background-image: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed); | |
transition: all 0.4s ease-in-out; | |
} | |
button:hover { | |
background-position: 100% 0; | |
transition: all 0.4s ease-in-out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment