css图片单选框,纯css3实现效果超级炫的checkbox复选框和radio单选框

之前为大家分享了好多css3实现的按钮。今天要为大家分享的是纯css3实现的checkbox复选框和radio单选框,效果超级炫。先让我们看看图吧!

f3b61033f897d38c1ab6d3e133cbcf01.gif 

源码下载这个实例完全由css3实现的没有任何js代码。下面我们一起看下实现代码吧

html代码:

复制代码代码如下:

Checkbox

Checkbox

Checkbox

Radio option

Radio option

Radio option

css3代码:

复制代码代码如下:

@-webkit-keyframes click-wave {

0% {

width: 40px;

height: 40px;

opacity: 0.35;

position: relative;

}

100% {

width: 200px;

height: 200px;

margin-left: -80px;

margin-top: -80px;

opacity: 0.0;

}

}

@-moz-keyframes click-wave {

0% {

width: 40px;

height: 40px;

opacity: 0.35;

position: relative;

}

100% {

width: 200px;

height: 200px;

margin-left: -80px;

margin-top: -80px;

opacity: 0.0;

}

}

@-o-keyframes click-wave {

0% {

width: 40px;

height: 40px;

opacity: 0.35;

position: relative;

}

100% {

width: 200px;

height: 200px;

margin-left: -80px;

margin-top: -80px;

opacity: 0.0;

}

}

@keyframes click-wave {

0% {

width: 40px;

height: 40px;

opacity: 0.35;

position: relative;

}

100% {

width: 200px;

height: 200px;

margin-left: -80px;

margin-top: -80px;

opacity: 0.0;

}

}

.option-input {

-webkit-appearance: none;

-moz-appearance: none;

-ms-appearance: none;

-o-appearance: none;

appearance: none;

position: relative;

top: 13.33333px;

width: 40px;

height: 40px;

-webkit-transition: all 0.15s ease-out 0;

-moz-transition: all 0.15s ease-out 0;

transition: all 0.15s ease-out 0;

background: #cbd1d8;

border: none;

color: #fff;

cursor: pointer;

display: inline-block;

outline: none;

position: relative;

margin-right: 0.5rem;

z-index: 1000;

}

.option-input:hover {

background: #9faab7;

}

.option-input:checked {

background: #40e0d0;

}

.option-input:checked::before {

width: 40px;

height: 40px;

position: absolute;

content: '\2716';

display: inline-block;

font-size: 26.66667px;

text-align: center;

line-height: 40px;

}

.option-input:checked::after {

-webkit-animation: click-wave 0.65s;

-moz-animation: click-wave 0.65s;

animation: click-wave 0.65s;

background: #40e0d0;

content: '';

display: block;

position: relative;

z-index: 100;

}

.option-input.radio {

border-radius: 50%;

}

.option-input.radio::after {

border-radius: 50%;

}

body {

display: -webkit-box;

display: -moz-box;

display: box;

-webkit-box-orient: horizontal;

-moz-box-orient: horizontal;

box-orient: horizontal;

-webkit-box-pack: start;

-moz-box-pack: start;

box-pack: start;

-webkit-box-align: stretch;

-moz-box-align: stretch;

box-align: stretch;

background: #e8ebee;

color: #9faab7;

font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

text-align: center;

}

body div {

padding: 5rem;

}

body label {

display: block;

line-height: 40px;

}

是不是很简单。只要复制上面的html代码和css代码到页面上。运行就可以看到效果了。赶紧试一试吧。哈哈

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值