버튼 디자인-2 (button Design-2 with CSS)

좋아요 버튼 등으로 활용할 수 있는 버튼이다.

✔️ HTML

1
2
3
4
5
<button class="like">
<span class="material-icons-outlined before">favorite_border</span>
<span class="material-icons-outlined after">favorite</span>
<span class="text">Like</span>
</button>

✔️ CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.like {
display: flex;
gap: 10px;
justify-content: space-between;
align-items: center;
padding: 15px;
background-color: #fc8989;
border-radius: 35px;
border: 0px;
font-size: 25px;
margin: 0 auto;
color: #fff;
cursor: pointer;
transition: all .5s;
}
.like:hover {
background-color: #ff6e6e;
}
.like:hover .before {
opacity: 0;
}
.like .after {
position: absolute;
opacity: 0;
color: #fff;
}
.like:hover .after {
opacity: 1;
animation: beat 1s infinite;
}
@keyframes beat {
0% {
transform: scale(1);
}

15% {
transform: scale(1.15);
}

30% {
transform: scale(1);
}

45% {
transform: scale(1.15);
}

60% {
transform: scale(1);
}
}

✔️ GitHub
링크