1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 纯Css代码美化checkbox复选框 radios单选框和滑动按钮简单方法

纯Css代码美化checkbox复选框 radios单选框和滑动按钮简单方法

时间:2023-01-12 17:17:46

相关推荐

纯Css代码美化checkbox复选框 radios单选框和滑动按钮简单方法

web前端|css教程

checkbox,radios,css

web前端-css教程

福利充值源码,ubuntu 安全图形模式,微服务要依赖tomcat,爬虫基本过程,php如何关联链接,无锡抖音搜索排名seo怎么做lzw

我们知道css可以美化前端页面,本文我们就和大家分享纯Css代码美化checkbox复选框、radios单选框和滑动按钮的简单方法,希望能帮助到大家。

效果预览

源码带自动采集,vscode四个空格,ubuntu 网卡 自动,tomcat 45秒限制,孢子爬虫数据,if 大于小于 php,随州广告seo推广开户,jsp网站开发源码实例,国外的网站模板lzw

1. 复选框

.switch { margin: 20px 20px 0 0; display: flex; align-items: center; width: auto; } .checkbox-input { display: none } .checkbox { -webkit-transition: background-color 0.3s; transition: background-color 0.3s; background-color: #fff; border: 1px solid #d7d7d7; border-radius: 3px; width: 16px; height: 16px; vertical-align:middle; margin: 0 5px; } .checkbox-input:checked+.checkbox { background-color: #57ad68; } .checkbox-input:checked+.checkbox:after { content: "\2714"; display: inline-block; height: 100%; width: 100%; color: #fff; text-align: center; line-height: 16px; font-size: 12px; box-shadow: 0 0 4px #57ad68; }

2. 单选框

.switch { display: flex; align-items: center; width: auto; float: left; } .radio-beauty-container .radio-beauty { width: 16px; height: 16px; box-sizing: border-box; display: inline-block; border: 1px solid #d7d7d7; margin: 0 5px; border-radius: 50%; transition: 0.2s; } .radio-beauty-container input[type="radio"]:checked+.radio-beauty { border: solid 1px green; padding: 3px; background-color: green; background-clip: content-box; box-shadow: inset 0 0 1px rgba(0,128,0, 0.2), 0 0 3px green; }

ktv系统源码,vscode有趣的程序,eve ng ubuntu,tomcat启动位置设置,爬虫vip,php视频cms,开业seo软文刊登,商务网站http源代码,.net 网站系统模板lzw

3. 滑动按钮

.switch-slide-label { display: block; width: 34px; height: 18px; background: #ccc; border-radius: 30px; cursor: pointer; position: relative; -webkit-transition: 0.3s ease; transition: 0.3s ease; }.switch-slide-label:after { content: \; display: block; width: 16px; height: 16px; border-radius: 100%; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); position: absolute; left: 1px; top: 1px; -webkit-transform: translateZ(0); transform: translateZ(0); -webkit-transition:0.3s ease; transition:0.3s ease; }.switch-slide input:checked+label { background: #34bf49; transition: 0.3s ease; } .switch-slide input:checked+label:after { left: 17px; }

最简洁的代码美化复选框、单选框和滑动按钮

效果预览

1. 复选框

.switch { margin: 20px 20px 0 0; display: flex; align-items: center; width: auto; } .checkbox-input { display: none } .checkbox { -webkit-transition: background-color 0.3s; transition: background-color 0.3s; background-color: #fff; border: 1px solid #d7d7d7; border-radius: 3px; width: 16px; height: 16px; vertical-align:middle; margin: 0 5px; } .checkbox-input:checked+.checkbox { background-color: #57ad68; } .checkbox-input:checked+.checkbox:after { content: "\2714"; display: inline-block; height: 100%; width: 100%; color: #fff; text-align: center; line-height: 16px; font-size: 12px; box-shadow: 0 0 4px #57ad68; }

2. 单选框

.switch { display: flex; align-items: center; width: auto; float: left; } .radio-beauty-container .radio-beauty { width: 16px; height: 16px; box-sizing: border-box; display: inline-block; border: 1px solid #d7d7d7; margin: 0 5px; border-radius: 50%; transition: 0.2s; } .radio-beauty-container input[type="radio"]:checked+.radio-beauty { border: solid 1px green; padding: 3px; background-color: green; background-clip: content-box; box-shadow: inset 0 0 1px rgba(0,128,0, 0.2), 0 0 3px green; }

3. 滑动按钮

.switch-slide-label { display: block; width: 34px; height: 18px; background: #ccc; border-radius: 30px; cursor: pointer; position: relative; -webkit-transition: 0.3s ease; transition: 0.3s ease; }.switch-slide-label:after { content: \; display: block; width: 16px; height: 16px; border-radius: 100%; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); position: absolute; left: 1px; top: 1px; -webkit-transform: translateZ(0); transform: translateZ(0); -webkit-transition:0.3s ease; transition:0.3s ease; }.switch-slide input:checked+label { background: #34bf49; transition: 0.3s ease; } .switch-slide input:checked+label:after { left: 17px; }

相关推荐:

HTML页面中的的美化checkbox_html/css_WEB-ITnose

使用jquery与图片美化checkbox和radio控件的代码(打包下载)_jquery

有关radio、checkbox的课程推荐10篇

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。