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

여러개의 버튼이 같은 레벨에 있어야할 때 사용할 수 있다.

✔️ HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="buttonBox">
<a class="button red" href="javascript:;">
<span>Button</span>
<span class="material-icons-outlined icons">delete</span>
</a>
<a class="button blue" href="javascript:;">
<span>Button</span>
<span class="material-icons-outlined icons">save</span>
</a>
<a class="button green" href="javascript:;">
<span>Button</span>
<span class="material-icons-outlined icons">done</span>
</a>
</div>

✔️ 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
.buttonBox {
display: flex;
width: 100%;
height: 50px;
}
.buttonBox .button {
flex: 1;
color: #aaa;
background: #fff;
border-right: 1px solid #ccc;
font-size: 17px;
text-align: center;
line-height: 50px;
transition: all 0.5s ease-in-out;
text-decoration: none;
}
.buttonBox .button:last-child {
border: 0px;
}
.buttonBox .button:hover {
flex: 2;
}
.buttonBox .button.red:hover {
color: #fff;
background: #d32f2f;
}
.buttonBox .button.blue:hover {
color: #fff;
background: #1976d2;
}
.buttonBox .button.green:hover {
color: #fff;
background: #388e3c;
}
.buttonBox .button .icons {
vertical-align: text-bottom;
width: 0;
margin-left: 5px;
overflow: hidden;
font-size: 22px;
transition: width 0.5s ease-in-out;
}
@media all and (min-width: 420px) {
.buttonBox .button:hover .icons {
width: 20px;
}
}

✔️ GitHub
링크