如何实现超炫checkbox复选框和radio单选框-创新互联

这篇文章主要讲解了“如何实现超炫checkbox复选框和radio单选框”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何实现超炫checkbox复选框和radio单选框”吧!

成都创新互联公司专注于企业全网营销推广、网站重做改版、五莲网站定制设计、自适应品牌网站建设、H5网站设计商城网站建设、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为五莲等各大城市提供网站开发制作服务。

如何实现超炫checkbox复选框和radio单选框

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

html代码:

代码如下:

<div >
           <label>
               <input type="checkbox" class="option-input checkbox" checked="">
               Checkbox
           </label>
           <label>
               <input type="checkbox" class="option-input checkbox">
               Checkbox
           </label>
           <label>
               <input type="checkbox" class="option-input checkbox">
               Checkbox
           </label>
       </div>
       <div >
           <label>
               <input type="radio" class="option-input radio" name="example">
               Radio option
           </label>
           <label>
               <input type="radio" class="option-input radio" name="example">
               Radio option
           </label>
           <label>
               <input type="radio" class="option-input radio" name="example">
               Radio option
           </label>
       </div>


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%;
}</p> <p>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;
}


感谢各位的阅读,以上就是“如何实现超炫checkbox复选框和radio单选框”的内容了,经过本文的学习后,相信大家对如何实现超炫checkbox复选框和radio单选框这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联网站建设公司,,小编将为大家推送更多相关知识点的文章,欢迎关注!

文章名称:如何实现超炫checkbox复选框和radio单选框-创新互联
转载注明:https://www.cdcxhl.com/article10/dosodo.html

成都网站建设公司_创新互联,为您提供营销型网站建设微信公众号网站改版网站维护虚拟主机商城网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营