/
12.html
240 lines (220 loc) · 4.46 KB
/
12.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<title>CSS3 小练习 | cnzsb</title>
<link rel="stylesheet" type="text/css" href="../public/css/reset.css">
<style type="text/css">
body {
width: 100%;
height: 100%;
width: 300px;
margin: 0 auto;
text-align: center;
}
div[class*='demo'] {
margin: 20px 0;
}
/*
demo1
*/
.demo1 table {
width: 300px;
text-align: left;
}
.demo1 table tr:first-child {
color: #fff;
background-color: #000;
}
.demo1 table tr:nth-child(2),
.demo1 table tr:nth-child(3),
.demo1 table tr:nth-child(4) {
color: #f00;
}
.demo1 table tr:not(:first-child):nth-child(odd) {
background-color: #ccc;
}
/*
demo2
*/
.demo2 input {
width: 100px;
padding: 2px 5px;
text-align: center;
border: 1px solid #777676;
-webkit-transition: all 0.25s ease-in;
transition: all 0.25s ease-in;
}
.demo2 input:focus {
width: 200px;
border-color: #7DAFEA;
border-radius: 2px;
-webkit-box-shadow: 0 0 1px 2px #7DAFEA;
box-shadow: 0 0 1px 2px #7DAFEA;
}
/*
demo3
*/
.demo3 {
width: 300px;
height: 200px;
position: relative;
}
/* 导航标签 */
.tab {
position: absolute;
bottom: 5px;
right: 5px;
z-index: 100;
}
.tab li,
.tab li a {
display: inline-block;
}
.tab li a {
background-color: rgba(216, 214, 214, 0.5);
color: #FFF;
padding: 5px 8px;
cursor: pointer;
}
.tab li:hover {
background-color: rgba(216, 214, 214, 0.8);
}
/* 轮播 */
.slide-wrapper li {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
text-align: center;
color: #FFF;
font-size: 100px;
font-weight: bold;
line-height: 200px;
}
.slide-wrapper li:nth-child(1) {
background-color: #FC4343;
}
.slide-wrapper li:nth-child(2) {
background-color: #279CFE;
}
.slide-wrapper li:nth-child(3) {
background-color: #FD7443;
}
/* target对象添加动画并使当前对象z-index处于最上层 */
.slide-wrapper>li:target {
z-index: 10;
-webkit-animation: slide 1s;
animation: slide 1s;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
/* 非target对象添加动画使之z-index降至低于target的层 */
.slide-wrapper li:not(:target){
-webkit-animation: notTarget 1s;
animation: notTarget 1s;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
/* 轮播动画 */
@-webkit-keyframes slide {
0% {left: 100%;}
100% {left: 0;}
}
@keyframes slide {
0% {left: 100%;}
100% {left: 0;}
}
/* 非target对象动画 */
@-webkit-keyframes notTarget {
0% {z-index: 5;}
100% {z-index: 5;}
}
@keyframes notTarget {
0% {z-index: 5;}
100% {z-index: 5;}
}
</style>
<script type="text/javascript" src="../public/js/analytics.js"></script>
</head>
<body>
<div class="demo1">
<table>
<tr>
<th>排名</th>
<th>网站</th>
<th>热度</th>
</tr>
<tr>
<td>1.</td>
<td>百度前端技术学院</td>
<td>13000</td>
</tr>
<tr>
<td>2.</td>
<td>百度前端技术学院</td>
<td>12000</td>
</tr>
<tr>
<td>3.</td>
<td>百度前端技术学院</td>
<td>11000</td>
</tr>
<tr>
<td>4.</td>
<td>百度前端技术学院</td>
<td>10000</td>
</tr>
<tr>
<td>5.</td>
<td>百度前端技术学院</td>
<td>9000</td>
</tr>
<tr>
<td>6.</td>
<td>百度前端技术学院</td>
<td>8000</td>
</tr>
<tr>
<td>7.</td>
<td>百度前端技术学院</td>
<td>7000</td>
</tr>
<tr>
<td>8.</td>
<td>百度前端技术学院</td>
<td>6000</td>
</tr>
<tr>
<td>9.</td>
<td>百度前端技术学院</td>
<td>5000</td>
</tr>
<tr>
<td>10.</td>
<td>百度前端技术学院</td>
<td>4000</td>
</tr>
</table>
</div>
<div class="demo2">
<input type="text" placeholder="点我查看效果">
</div>
<div class="demo3">
<ul class="slide-wrapper">
<li id="slide1">1</li>
<li id="slide2">2</li>
<li id="slide3">3</li>
</ul>
<ul class="tab">
<li><a href="#slide1">1</a></li>
<li><a href="#slide2">2</a></li>
<li><a href="#slide3">3</a></li>
</ul>
</div>
</body>
</html>