zent
Version:
一套前端设计语言和基于React的实现
113 lines (112 loc) • 2.36 kB
CSS
.zent-checkbox-wrap {
display: inline-block;
cursor: pointer;
font-weight: 400;
font-size: 12px;
line-height: 14px;
margin: 0;
padding: 0;
margin-right: 15px;
vertical-align: middle
}
.zent-checkbox-wrap.zent-checkbox-disabled {
cursor: not-allowed;
}
.zent-checkbox-wrap:last-child {
margin-right: 0;
}
.zent-checkbox {
position: relative;
display: inline-block;
width: 14px;
height: 14px;
white-space: nowrap;
outline: none;
vertical-align: middle;
line-height: 1;
margin: 0;
padding: 0;
}
.zent-checkbox input {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
cursor: pointer;
}
.zent-checkbox + span {
margin-left: 5px;
margin-right: 5px;
vertical-align: middle;
line-height: 16px;
}
.zent-checkbox-inner {
position: relative;
top: 0;
left: 0;
display: inline-block;
width: 14px;
height: 14px;
border-radius: 2px;
border: 1px solid #bbb;
background: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: all 0.3s;
transition: all 0.3s
}
.zent-checkbox-inner::after {
-webkit-box-sizing: content-box;
box-sizing: content-box;
position: absolute;
display: block;
content: ' ';
font-size: 0;
top: 3px;
left: 2px;
width: 6px;
height: 3px;
border: 2px solid #fff;
background: transparent;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg) scale(0);
transform: rotate(-45deg) scale(0);
-webkit-transition: all 0.12s ease-in-out;
transition: all 0.12s ease-in-out;
}
.zent-checkbox-checked .zent-checkbox-inner {
border-color: #27f;
background: #38f
}
.zent-checkbox-checked .zent-checkbox-inner::after {
-webkit-transform: rotate(-45deg) scale(1);
transform: rotate(-45deg) scale(1);
}
.zent-checkbox-indeterminate .zent-checkbox-inner {
border-color: #38f;
background: #fff
}
.zent-checkbox-indeterminate .zent-checkbox-inner::after {
top: 5px;
left: 3px;
width: 6px;
height: 2px;
border: none;
background: #38f;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
.zent-checkbox-disabled .zent-checkbox-inner {
opacity: 0.4;
}
.zent-checkbox-disabled input[type="checkbox"] {
cursor: not-allowed;
}