css 自订复选框 Posted 2021-05-13
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 自订复选框相关的知识,希望对你有一定的参考价值。
Custom checkbox
---------------
Empty box transforms into check. No additional markup, just input, label for it and some css
A [Pen](http://codepen.io/valerypatorius/pen/oXGMGL) by [Valery](http://codepen.io/valerypatorius) on [CodePen](http://codepen.io/).
[License](http://codepen.io/valerypatorius/pen/oXGMGL/license).
<div class="boxes">
<input type="checkbox" id="box-1">
<label for="box-1">Sustainable typewriter cronut</label>
<input type="checkbox" id="box-2" checked>
<label for="box-2">Gentrify pickled kale chips </label>
<input type="checkbox" id="box-3">
<label for="box-3">Gastropub butcher</label>
</div>
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
/*Page styles*/
html { height: 100%; }
body {
height: 100%;
margin: 0;
background: #363636;
display: -webkit-flex;
display: flex;
align-items: center;
}
.boxes {
margin: auto;
padding: 50px;
background: #484848;
}
/*Checkboxes styles*/
input[type="checkbox"] { display: none; }
input[type="checkbox"] + label {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 20px;
font: 14px/20px 'Open Sans', Arial, sans-serif;
color: #ddd;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
input[type="checkbox"] + label:last-child { margin-bottom: 0; }
input[type="checkbox"] + label:before {
content: '';
display: block;
width: 20px;
height: 20px;
border: 1px solid #6cc0e5;
position: absolute;
left: 0;
top: 0;
opacity: .6;
-webkit-transition: all .12s, border-color .08s;
transition: all .12s, border-color .08s;
}
input[type="checkbox"]:checked + label:before {
width: 10px;
top: -5px;
left: 5px;
border-radius: 0;
opacity: 1;
border-top-color: transparent;
border-left-color: transparent;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
以上是关于css 自订复选框的主要内容,如果未能解决你的问题,请参考以下文章
css 自订复选框
css 自订复选框
scss 自订复选框
javascript 在Flask使用自订js,并自订按钮切换显示div
text 指令 - 建立自订大小的档案
text 自订过滤器