JSDM

HTML

 
1
<h1>纯css数字游戏</h1>
2
<section>
3
  <h2>选择数字让最后的计算结果等于 72:</h1>
4
  <input id="a" type="checkbox"><label for="a">64</label>
5
  <input id="b" type="checkbox"><label for="b">16</label>
6
  <input id="c" type="checkbox"><label for="c">-32</label>
7
  <input id="d" type="checkbox"><label for="d">128</label>
8
  <input id="e" type="checkbox"><label for="e">4</label>
9
  <input id="f" type="checkbox"><label for="f">-8</label>
10
  <span class="sum"></span>
11
</section>

CSS

x
 
1
@import url(http://fonts.lug.ustc.edu.cn/css?family=Droid+Sans:700);
2
3
/* counters */
4
5
body {
6
  counter-reset: sum;
7
}
8
9
#a:checked { counter-increment: sum 64; }
10
#b:checked { counter-increment: sum 16; }
11
#c:checked { counter-increment: sum -32; }
12
#d:checked { counter-increment: sum 128; }
13
#e:checked { counter-increment: sum 4; }
14
#f:checked { counter-increment: sum -8; }
15
16
.sum::before {
17
  content: '= ' counter(sum);
18
}
19
20
/* the rest is just to make things pretty */
21
22
body {
23
  margin: 32px;
24
  font: 700 32px/1 'Droid Sans', sans-serif;
25
  color: #fff;
26
  background-color: #583f3f;
27
}
28
29
h1 {
30
  margin: 0 0 32px;
31
  font-size: 48px;
32
}
33
34
h2 {
35
  margin: 0 0 8px 8px;
36
  font-size: inherit;
37
}
38
39
section {
40
  margin-bottom: 16px;
41
  padding: 16px;
42
  border-radius: 4px;
43
  overflow: hidden;
44
  background-color: rgba(255, 255, 255, .1);
45
}
46
47
input {
48
  position: absolute;
49
  left: -9999px;
50
}
51
52
label {
53
  float: left;
54
  margin: 8px;
55
  padding: 16px;
56
  border-radius: 4px;
57
  border: solid 2px rgba(255, 255, 255, .4);
58
  background-color: rgba(255, 255, 255, .2);
59
  cursor: pointer;
60
  transition: all .1s;
61
}
62
63
label::before {
64
  display: inline;
65
}
66
67
input:checked + label {
68
  border: solid 2px #fff;
69
  background-color: rgba(255, 255, 255, .4);
70
  box-shadow: 0 0 10px #fff;
71
}
72
73
span {
74
  float: left;
75
  margin: 8px;
76
  padding: 18px;
77
  border-radius: 4px;
78
  background-color: rgba(0, 0, 0, .1);
79
}
80
81
#a:checked ~ #b:checked ~ #c:not(:checked) ~ #d:not(:checked) ~ #e:not(:checked) ~ #f:checked ~ .sum::after {
82
  content: ' (正确)';
83
}
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

xxxxxxxxxx
1
 
1
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................