-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
119 lines (119 loc) · 2.43 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
<style type="text/css">
.title:hover {
opacity: 0.5;
}
ul,
li {
display: inline-block;
margin: 0;
padding: 0;
}
li {
margin-right: 10px;
}
ul li:last-of-type {
margin-right: 0;
}
.select {
display: none;
}
.select:before {
display: block;
content: '';
height: 10px;
opacity: 0;
}
.select:hover {
display: block;
}
.title:hover + .select{
display: block;
}
input[type="radio"] {
display: none;
}
input[type="radio"] + span {
display: inline-block;
padding: 3px;
width: 6px;
height: 6px;
border: 1px solid #000;
border-radius: 50%;
background: transparent;
background-clip: content-box;
transition: all 0.5s;
}
input[type="radio"]:checked + span{
background: #000;
background-clip: content-box;
}
input[type="radio"] + span + label {
display: inline-block;
font-size: 12px;
}
ul {
width: 100%;
}
li:first-of-type:nth-last-of-type(2),
li:first-of-type:nth-last-of-type(2) ~ li {
width: 50%;
}
li:first-of-type:nth-last-of-type(3),
li:first-of-type:nth-last-of-type(3) ~ li {
width: 33.3%;
}
li:first-of-type:nth-last-of-type(4),
li:first-of-type:nth-last-of-type(4) ~ li {
width: 25%;
}
.triangle {
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid red;
}
.counterReset {
counter-reset: fruit 1;
}
.counterReset input:checked {
counter-increment: fruit;
}
.total::after {
content: counter(fruit);
font-size: 14px;
color: red;
}
</style>
<body>
<div class="title">你好</div>
<ul class="select">
<li>选择1</li>
<li>选择2</li>
<li>选择3</li>
<li>选择4</li>
</ul>
<input id="radio1" type="radio" name="singleSelect"></input>
<span></span>
<label for="radio1">选择1</label>
<input id="radio2" type="radio" name="singleSelect"></input>
<span></span>
<label for="radio2">选择2</label>
<div class="triangle"></div>
<div class="counterReset">
<label><input type="checkbox"></input>香蕉</label>
<label><input type="checkbox"></input>苹果</label>
</div>
<p>你选择了<span class="total"></span>个水果</p>
</body>
</html>