您的位置:首页 > Web前端 > CSS

CSS3美化复选框checkbox

2017-05-24 00:00 281 查看
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>使用CSS3美化复选框checkbox</title>
</head>
<style type="text/css">
.chk_2 {
display: none;
}
.chk_2 + label {
display: inline-block;
position: relative;
}

.chk_2 + label:hover {
border-top: 1px solid #FC8C1E;
background: #FC8C1E;
box-shadow: inset 0 -50px 37px -30px rgba(255, 222, 197, 0.07), 0 0 13px rgba(0, 0, 0, 0.6);
}

.chk_2 + label:active {
border-top: none;
background: red;

}

.chk_2 + label:after {
content: ' ';
border-radius: 100px;
width: 20px;
position: absolute;
box-shadow: inset 0px 16px 40px rgba(0, 0, 0, 0.4);
height: 20px;
}

.chk_2 + label:before {
content: ' ';
width: 20px;
position: absolute;
z-index: 999;
background: url(clearicon.png); /*这里放上需要的图片就好*/
background-size: 100% 100%;
height: 20px;
display: none;
}

.chk_2:checked + label:before {
display: block;
}

</style>
<body>
<div class="wrap" style="width:198px">
<input type="checkbox" id="checkbox_b1" class="chk_2" /><label for="checkbox_b1"></label>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: