css+svg实现4款开关checkbox美化效果代码

代码语言:html

所属分类:表单美化

代码描述:css+svg实现4款开关checkbox美化效果代码

代码标签: css svg checkbox 开关 美化

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html>
<html>

<head>
    <meta charset="utf-8">

    <style>
        body{background:#000;margin:0;padding:0;}
        
        
        .wrapper{
        	display: -webkit-box;
        	display: -ms-flexbox;
        	display: flex;
        	width: 400px;
        	margin: 40vh auto 0;
        	-ms-flex-wrap: wrap;
        	    flex-wrap: wrap;
        	-webkit-transform: translateY(-50%);
        	        transform: translateY(-50%);
        }
        
        .switch_box{
        	display: -webkit-box;
        	display: -ms-flexbox;
        	display: flex;
        	max-width: 200px;
        	min-width: 200px;
        	height: 200px;
        	-webkit-box-pack: center;
        	    -ms-flex-pack: center;
        	        justify-content: center;
        	-webkit-box-align: center;
        	    -ms-flex-align: center;
        	        align-items: center;
        	-webkit-box-flex: 1;
        	    -ms-flex: 1;
        	        flex: 1;
        }
        
        /* Switch 1 Specific Styles Start */
        
        .box_1{
        	background: #eee;
        }
        
        input[type="checkbox"].switch_1{
        	font-size: 30px;
        	-webkit-appearance: none;
        	   -moz-appearance: none;
        	        appearance: none;
        	width: 3.5em;
        	height: 1.5em;
        	background: #ddd;
        	border-radius: 3em;
        	position: relative;
        	cursor: pointer;
        	outline: none;
        	-webkit-transition: all .2s ease-in-out;
        	transition: all .2s ease-in-out;
          }
          
          input[type="checkbox"].switch_1:checked{
        	background: #0ebeff;
          }
          
          input[type="checkbox"].switch_1:after{
        	position: absolute;
        	content: "";
        	width: 1.5em;
        	height: 1.5em;
        	border-radius: 50%;
        	background: #fff;
        	-webkit-box-shadow: 0 0 .25em rgba(0,0,0,.3);
        	        box-shadow: 0 0 .25em rgba(0,0,0,.3);
        	-webkit-transform: scale(.7);
        	        transform: scale(.7);
        	left: 0;
        	-webkit-transition: all .2s ease-in-out;
        	transit.........完整代码请登录后点击上方下载按钮下载查看

网友评论0