پیشنمایش زنده
کد 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;
border: 1px solid #fff;
background-color: transparent;
position: relative;
}
.menu__button::before {
content: '';
width: 100%;
height: 0;
background-color: #fff;
position: absolute;
bottom: 0;
left: 0;
z-index: -1;
transition: all .4s;
}
.menu__button:hover::before {
height: 100%;
top: 0;
}
.menu__button span {
color: #fff;
line-height: 1;
transition: color .4s;
}
.menu__button:hover span {
color: #000;
}