- after 가상 요소를 이용해 동적인 효과 구현!
- after 가상 요소의 넓이를 0 으로 지정한 뒤 커서가 올라갔을때(hover) 넓이를 100%로 늘린다.
- transition 으로 변화 속도 조절
* {
box-sizing: border-box;
margin: 0px;
padding: 0px;
}
body {
display: flex;
justify-content: center;
align-items: center;
font-family: "Lato", sans-serif;
height: 100vh;
width: 100%;
}
button,
input,
textarea {
font-family: "Lato", sans-serif;
}
button {
border: none;
background-color: #fff;
}
.line-button {
position: relative;
padding: 18px 30px;
width: 500px;
font-size: 100px;
font-weight: 400px;
line-height: 1.25;
color: #151b26;
cursor: pointer;
transition: font-size 250ms ease-in;
}
.line-button::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 7px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
background-color: #0066ff;
transition: width 250ms ease-in, background-color 250ms ease-in,
background-image 250ms ease-in;
}
.line-button:hover::after {
width: 100%;
background-color: #0093e9;
background-image: linear-gradient(160deg, #0093e9 0%, #80d0c7 100%);
}
'WEB animation & effect > button' 카테고리의 다른 글
반짝이는 버튼 effect (0) | 2021.10.04 |
---|---|
그라데이션 버튼 effect (0) | 2021.10.04 |
버튼 hover 효과 : square (0) | 2021.09.29 |
버튼 효과 : painting (0) | 2021.09.29 |