Колеги всім привіт.
Сьогодні ми покажемо, як створити кнопки з ефектами анімації при наведенні на чистому HTML і CSS.
HTML Код:
<body>
<div class="container">
<button class="btn btn1">Button 1</button>
<button class="btn btn2">Button 2</button>
<button class="btn btn3">Button 3</button>
<button class="btn btn4">Button 4</button>
</div>
</body>
CSS Код:
body{
margin: 0;
padding: 0;
background-color: #DED7E6;
}
.container{
text-align: center;
margin-top: 360px;
}
.btn{
border: 1px solid #776F70;
background: none;
padding: 25px 50px;
font-size: 20px;
letter-spacing: 8px;
font-family: "montserrat";
cursor: pointer;
margin: 10px;
transition: 0.5s;
position: relative;
overflow: hidden;
border-radius: 5px;
}
.btn1,.btn2{
color: #776F70;
}
.btn3,.btn4{
color: #DED7E6;
}
.btn1:hover,.btn2:hover{
color: #DED7E6;
}
.btn3:hover,.btn4:hover{
color: #776F70;
}
.btn::before{
content: "";
position: absolute;
left: 0;
width: 100%;
height: 0%;
background: #776F70;
z-index: -1;
transition: 0.8s;
}
.btn1::before,.btn3::before{
top: 0;
border-radius: 0 0 50% 50%;
}
.btn2::before,.btn4::before{
bottom: 0;
border-radius: 50% 50% 0 0;
}
.btn3::before,.btn4::before{
height: 180%;
}
.btn1:hover::before,.btn2:hover::before{
height: 180%;
}
.btn3:hover::before,.btn4:hover::before{
height: 0%;
}
Дякую всім, я сподіваюся що вам моя стаття хоч чимось допомогла.