-
Notifications
You must be signed in to change notification settings - Fork 0
/
3d导航栏.html
98 lines (85 loc) · 1.98 KB
/
3d导航栏.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin: 0;
padding: 0;
}
ul {
margin: 100px;
}
ul li {
width: 120px;
height: 35px;
list-style: none;
perspective: 300px;
float: left;
margin: 0 10px;
}
.box {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
transition: all .6s;
text-align: center;
line-height: 35px;
color: #ffffff;
}
.box:hover{
transform: rotateX(90deg);
}
.front, .bottom {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.front {
background-color: pink;
z-index: 2;
/*royalblue盒子往下走,pink盒子往前走*/
transform: translateZ(17.5px);
}
.bottom {
background-color: royalblue;
/*必须先移动后旋转*/
transform: translateY(50%) rotateX(-90deg);
}
</style>
</head>
<body>
<div>
<ul>
<li>
<div class="box">
<div class="front">我的</div>
<div class="bottom">你的</div>
</div>
</li>
<li>
<div class="box">
<div class="front"></div>
<div class="bottom"></div>
</div>
</li>
<li>
<div class="box">
<div class="front"></div>
<div class="bottom"></div>
</div>
</li>
<li>
<div class="box">
<div class="front"></div>
<div class="bottom"></div>
</div>
</li>
</ul>
</div>
</body>
</html>