پیشنمایش زنده
کد HTML
<button class="menu__button">
<span>Hover me!</span>
</button>
کد CSS
/* <reset-style> ============================ */
button {
border: none;
background: none;
padding: 0;
margin: 0;
cursor: pointer;
font-family: inherit;
}
/* <main-style> ============================ */
.menu__button {
min-width: 62px;
height: 36px;
display: flex;
justify-content: center;
align-items: center;
padding: 8px 16px;
background-color: #fff;
transition: background-color .4s;
}
.menu__button span {
color: #000;
line-height: 1;
transition: color .4s;
}
.menu__button:hover {
background: linear-gradient(90deg, #fff 50%, transparent 0) repeat-x,
linear-gradient(90deg, #fff 50%, transparent 0) repeat-x,
linear-gradient(0deg, #fff 50%, transparent 0) repeat-y,
linear-gradient(0deg, #fff 50%, transparent 0) repeat-y;
background-size: 6px 2px, 6px 2px, 2px 6px, 2px 6px;
background-position: 0 0, 0 100%, 0 0, 100% 0;
animation: linearGradientMove .4s infinite linear;
}
.menu__button:hover span {
color: #fff;
}
@keyframes linearGradientMove {
100% {
background-position: 6px 0, -6px 100%, 0 -6px, 100% 6px;
}
}