CSS神奇東東

CSS 神奇東東

形狀

triangle

1
2
3
4
5
6
7
.triangle{
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid white; /*改成border-top會變成倒三角*/
}

Hexagon




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.hexagon{
width: 100px;
height: 57.735px;
background: blue;
position: relative;
}
.hexagon::before,.hexagon::after{
content: "";
position: absolute;
left:0;
width: 0;
height: 0;
border-left:50px solid transparent;
border-right: 50px solid transparent;
}
.hexagon::before{
top: -28.8675px;
border-bottom: 28.8675px solid blue;
}
.hexagon::after{
bottom: -28.8675px;
border-top: 28.8675px solid blue;
}

See the Pen Untitled by salt (@saltyen) on CodePen.

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.wrapper{
position: relative;
}
.button{
position: relative;
z-index: 2;
display: flex;
align-items: center;
justify-content: space-between;
gap:24px;
height:80px;
width:230px;
padding: 0 30px;
border-radius: 10px;
color: #f7f7f7;
background: #322d3a;
}
.text{
font-size:19px;
}
.icon{
position: relative;
width:20px;
height:20px;
}
.input{
position:absolute;
transform: scale(0);
}
.menu{
overflow: hidden;
position: absolute;
z-index:1;
top:70px;
left:0;
width:230px;
}
.icon::before, .icon::after{
content: "";
position: absolute;
top: 6px;
left:11px;
width:3px;
height:10px;
border-radius:1px;
background:#fff;
transition: all 0.3s;
}
.icon::before{
transform: translate(-5px,0) rotate(-45deg);
}
.icon::after{
transform: translate(0,0) rotate(45deg);
}
.menu ul{
width:100%;
margin:0;
padding:24px 0;
background: #1f1b25;
border-radius: 0 0 10px 10px;
transform: translateY(-100%);
list-style: none;
transition: all 0.3s;
}
.menu li{
display: flex;
align-items: center;
width:inherit;
padding: 0 10px;
}
.menu li:not(:last-child){
margin-bottom:6px;
}
.menu li>a{
display: flex;
align-items: center;
width:inherit;
height: 44px;
padding: 0 20px;
border-radius: 8px;
font-size:17px;
color: #f7f7f7;
cursor: pointer;
transition: all 0.25s;
}
.menu li>a:hover{
background: #312b3a;
}
input:checked ~ .menu ul{
transform: translateY(0);
}
input:checked ~ .button{
background: #4461fd;
}
input:checked ~ .button .icon::before{
transform: translate(-3px, 0) rotate(45deg) scaleY(2);
}
input:checked ~ .button .icon::after{
transform: translate(-3px, 0) rotate(45deg) scaleY(2);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div class="wrapper" id="wp" style="position: relative;">
<input type="checkbox" id="input" />
<label for="input" class="button">
<span class="text">
My setting
</span>
<span class="icon"></span>
</label>
<div class="menu" id="mn">
<ul>
<li><a>Appearance</a></li>
<li><a>Account Privacy</a></li>
<li><a>Friend Request</a></li>
</ul>
</div>
</div>

Animation

海浪誒

See the Pen Simple CSS Waves | Mobile & Full width by Goodkatz (@goodkatz) on CodePen.

so cute

See the Pen Bongo Cat Codes #2 - Jamming by Caroline Artz (@carolineartz) on CodePen.