css3数字统计,一款纯css3实现的数字统计游戏

今天给大家分享一款纯css3实现的数字统计游戏。这款游戏的规则的是将所有的数字相加等于72。这款游戏的数字按钮做得很美观,需要的时候可以借用下。一起看下效果图:

dd4508ac9415d876b61d67d779fdab68.png

实现的代码。

html代码:

CSS Counter Game

Pick the numbers that add up to 72:

64

16

-32

128

4

-8

css3代码:

body

{

counter-reset: sum;

}

#a:checked

{

counter-increment: sum 64;

}

#b:checked

{

counter-increment: sum 16;

}

#c:checked

{

counter-increment: sum -32;

}

#d:checked

{

counter-increment: sum 128;

}

#e:checked

{

counter-increment: sum 4;

}

#f:checked

{

counter-increment: sum -8;

}

.sum::before

{

content: '= ' counter(sum);

}

/* the rest is just to make things pretty */

body

{

margin: 32px;

font: 700 32px/1 'Droid Sans' , sans-serif;

color: #fff;

background-color: #583f3f;

}

h1

{

margin: 0 0 32px;

font-size: 48px;

}

h2

{

margin: 0 0 8px 8px;

font-size: inherit;

}

section

{

margin-bottom: 16px;

padding: 16px;

border-radius: 4px;

overflow: hidden;

background-color: rgba(255, 255, 255, .1);

}

input

{

position: absolute;

left: -9999px;

}

label

{

float: left;

margin: 8px;

padding: 16px;

border-radius: 4px;

border: solid 2px rgba(255, 255, 255, .4);

background-color: rgba(255, 255, 255, .2);

cursor: pointer;

transition: all .1s;

}

label::before

{

display: inline;

}

input:checked + label

{

border: solid 2px #fff;

background-color: rgba(255, 255, 255, .4);

box-shadow: 0 0 10px #fff;

}

span

{

float: left;

margin: 8px;

padding: 18px;

border-radius: 4px;

background-color: rgba(0, 0, 0, .1);

}

#a:checked ~ #b:checked ~ #c:not(:checked) ~ #d:not(:checked) ~ #e:not(:checked) ~ #f:checked ~ .sum::after

{

content: ' (hooray!)';

}

201603282312454295.jpg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值