码迷,mamicode.com
首页 > Web开发 > 详细

css 按钮

时间:2018-04-17 19:46:14      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:char   cursor   splay   :active   dev   abs   translate   example   rds   

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Examples</title>
<meta name="description" content="">
<meta name="keywords" content="">
<style>
*{margin:0;padding:0;}
body {background: #181818; } * {
box-sizing: border-box;
}

.cntr {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.hidden {
display: none;
}

.switch-label {
position: relative;
display: block;
height: 22px;
width: 40px;
background: #000;
border-radius: 13px;
cursor: pointer;
border: 2px solid #404040;
transition: all 0.2s ease;
}
.switch-label:after {
position: absolute;
left: -2px;
top: -2px;
display: block;
width: 22px;
height: 22px;
border-radius: 100px;
background: #a0a0a0;
box-shadow: 0 1px 2px rgba(0,0,0,0.4);
content: ‘‘;
transition: all 0.3s ease;
}
.switch-label:active:after {
width: 26px;
background: #fff;
}
.switch-ipt:checked + label {
background: #1db955;
border-color: #1db955;
}
.switch-ipt:checked + label:after {
left:16px;
background: #fff;
}
.switch-ipt:checked + label:active:after {
left:12px;
}
</style>
</head>
<body>

<div class="cntr">

<input type="checkbox" id="switch-for" class="switch-ipt hidden"/>
<label for="switch-for" class="switch-label"></label>

</div>

</body>
</html>

css 按钮

标签:char   cursor   splay   :active   dev   abs   translate   example   rds   

原文地址:https://www.cnblogs.com/dr-zhou/p/8868303.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!