Unique Button Hover Animation Using CSS Only

By: The Softorax Development Team

HTML

				
					<button>
        <span class="text">Hover me</span>
    </button>
				
			

CSS

				
					body {
    background-color: #131313;
    display: flex; 
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    margin: 0; 
}

button {
    display: flex;
    position: relative;
    background: linear-gradient(90deg, rgba(106, 21, 170, 1) 0%, rgba(155, 48, 255, 1) 100%);
    padding: 10px 20px;
    border: none;
    border-radius: 50px;
    z-index: 1;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
}

.text {
    color: #FFFFFF;
    font-family: "Prompt", sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    z-index: 3 !important;
}

button:hover {
    box-shadow: 0px 3px 20px 0px rgba(155,48,255,0.6);
}

button:active {
    scale: 0.9;
}

button::after {
    content: "";
    position: absolute;
    left: -100%;
    top: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
    border-radius: inherit;
    z-index: -1;
}

button:hover:after {
    left: 100%;
    transition: 0.5s ease-in;
}


button:hover .text {
    animation: scaletext .5s linear;
    
}

@keyframes scaletext {
    from {transform: scale(1);}
    50% {transform: scale(1.05);}
    to {transform: scale(1);}
}
				
			

Final Result

The Best WordPress Web Development Agency

Schedule a call

Let us get back to you