Unique CSS Button Gradient Hover Animation

By: The Softorax Development Team

HTML

				
					<div class="GradientButtonContainer">
        <button>Hover Me</button>
    </div>
				
			

CSS

				
					body {
    display: flex;
    background: #000000;
    height: 100vh;
    width: 100%;
    align-items: center;
    justify-content: center;
    z-index: 0;
}

@property --gradAngle {
    syntax: "<angle>";
    initial-value: 90deg;
    inherits: false;

}

.GradientButtonContainer button {
    background: #000000;
    display: flex;
    position: relative;
    border: none;
    color: #FFFFFF;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    padding: 10px 40px;
    border-radius: 50px;
    cursor: pointer;

}

.GradientButtonContainer button::after {
    position: absolute;
    content: "";
    inset: -1px;
    background: linear-gradient(var(--gradAngle), rgba(134, 228, 224, 1) 0%, rgba(134, 228, 224, 0) 90% );
    z-index: -1;
    border-radius: inherit;
    transition: --gradAngle 1s ease-in-out;
}


.GradientButtonContainer button:hover::after{
    --gradAngle: 270deg;
}
				
			

Final Result

The Best WordPress Web Development Agency

Schedule a call

Let us get back to you