پیشنمایش زنده
کد HTML
<button><span class="text">Hover me</span></button>
کد CSS
button {
position: relative;
overflow: hidden;
border: none;
color: #3b5998;
display: inline-block;
font-size: 15px;
line-height: 15px;
padding: 18px 18px 17px;
text-decoration: none;
cursor: pointer;
background: #fff;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
button span:first-child {
position: relative;
transition: color 600ms cubic-bezier(0.48, 0, 0.12, 1);
z-index: 10;
}
button:hover {
color: #fff;
}
button:after {
content: "";
position: absolute;
bottom: -50%;
left: 0;
width: 100%;
height: 100%;
background-color: #3b5998;
transform-origin: bottom center;
transition: transform 600ms cubic-bezier(0.48, 0, 0.12, 1);
transform: skewY(9.3deg) scaleY(0);
z-index: 1;
}
button:hover:after {
transform-origin: bottom center;
transform: skewY(9.3deg) scaleY(2);
}