web299.com
全部
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
首页
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
当前位置:
首页
>
网页特效
>
选项卡
纯CSS3炫酷Material Design风格单选按钮和复选框动画特效
分类:
选项卡
日期:
2024-05-14
点击(0)
评论(0)
演 示
免费下载
简介
##### HTML结构 该特效的复选框和单选按钮的HTML结构都是使用一个label标签来包裹一个input元素。 ```html
Checkbox
Radio option
``` ##### CSS样式 单选按钮和复选框的基本样式如下,其中::before伪元素用于制作单选按钮和复选框中的小叉,::after伪元素用于制作点击波动画效果。 ```html .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%; } ``` 然后使用CSS keyframe来制作Material Design风格的按钮点击波特效。 ```html @-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; } } ```
相关推荐
html5浪漫粒子表白文字特效
SlidesJS幻灯片特效
html5瀑布流相册特效
css3 svg实现的情人节表白鲜花动画特效
t-scroll.js基于ES6的DOM元素,过渡动画库插件
纯js写省市区三级联动效果
广告
广告