Есть у меня вот такая реализация, где при наведении плавно появляется нижний бордер, а теперь нужно в таком стиле сделать весь прямоугольник
Код, это все что слева
.order-row {
display: flex;
width: 50%;
height: 84vh;
margin-top: 1vh;
background: url(../img/14days.jpg) no-repeat;
background-size: cover;
}
.link {
display: flex;
margin: auto;
}
.link h2 {
display: block;
margin: auto;
text-align: center;
font-size: 30px;
font-weight: 400;
}
.link-order {
width: 435px;
height: 130px;
background: rgba(255, 255, 255, 0.7);
}
.link-order h2::after {
display: block;
content: '';
border-bottom: 1px solid #2d2d2d;
transform: scaleX(0);
transform-origin: 100% 50%;
transition: transform 450ms ease-in-out;
}
.link-order h2:hover::after {
transform: scaleX(1);
transform-origin: 0% 50%;
}
Ответ
Лучший вариант такой анимации без использования SVG будет выглядеть так:
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
height: 100vh;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-transform: uppercase;
}
a {
position: relative;
color: #333;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
display: block;
text-decoration: none;
background: none;
border: 0;
-webkit-box-shadow: inset 0 0 0 2px transparent;
box-shadow: inset 0 0 0 2px transparent;
padding: 20px 40px;
}
a:after,
a:before {
content: '';
display: block;
position: absolute;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid transparent;
width: 0;
height: 0;
}
a:after {
top: 0;
left: 0;
-webkit-transition: border-color 0s ease-in 0.8s, width 0.2s ease-in 0.6s, height 0.2s ease-in 0.4s;
-o-transition: border-color 0s ease-in 0.8s, width 0.2s ease-in 0.6s, height 0.2s ease-in 0.4s;
transition: border-color 0s ease-in 0.8s, width 0.2s ease-in 0.6s, height 0.2s ease-in 0.4s;
}
a:before {
bottom: 0;
right: 0;
-webkit-transition: border-color 0s ease-in 0.4s, width 0.2s ease-in 0.2s, height 0.2s ease-in;
-o-transition: border-color 0s ease-in 0.4s, width 0.2s ease-in 0.2s, height 0.2s ease-in;
transition: border-color 0s ease-in 0.4s, width 0.2s ease-in 0.2s, height 0.2s ease-in;
}
a:hover:after,
a:hover:before {
width: 100%;
height: 100%;
}
a:hover:after {
border-top-color: rgba(0, 0, 0, .3);
border-right-color: rgba(0, 0, 0, .3);
-webkit-transition: width 0.2s ease-out, height 0.2s ease-out 0.2s;
-o-transition: width 0.2s ease-out, height 0.2s ease-out 0.2s;
transition: width 0.2s ease-out, height 0.2s ease-out 0.2s;
}
a:hover:before {
border-bottom-color: rgba(0, 0, 0, .3);
border-left-color: rgba(0, 0, 0, .3);
-webkit-transition: border-color 0s ease-out 0.4s, width 0.2s ease-out 0.4s, height 0.2s ease-out 0.6s;
-o-transition: border-color 0s ease-out 0.4s, width 0.2s ease-out 0.4s, height 0.2s ease-out 0.6s;
transition: border-color 0s ease-out 0.4s, width 0.2s ease-out 0.4s, height 0.2s ease-out 0.6s;
}
Сделать заказ
Комментариев нет:
Отправить комментарий