如何更改复选框,复选框勾选样式
How to change checkbox, checkbox ticks styles
我这里有一个多 select 列表,如下所示。
但我无法更改 CSS。这是到目前为止我已经尝试过的代码,我能够获得轮廓颜色,内部刻度无法看到它。
input[type=checkbox], input[type=radio] {
margin: 4px 0 0;
margin-top: 1px;
height: 16px;
border-radius: 2px;
line-height: normal;
box-shadow: none;
outline-offset: -1px;
-webkit-appearance: none;
width: 16px !important;
margin: 5px;
appearance:none;
outline: 2px solid #455eab;
font-size: 2em;
}
.form-check-input{
width: 35px;
}
input[type="checkbox"]:checked ~ label::before {
color: #455eab;
}
<input class="form-check-input"[checked]=true type="checkbox">
<input class="form-check-input" type="checkbox" >
<input class="form-check-input" type="checkbox" >
<input class="form-check-input" type="checkbox" >
你是那个意思吗?
label {
cursor: pointer;
display: inline-block;
}
label input[type=checkbox] {
display: none;
}
label input[type=checkbox]:checked + .cb-icon {
background: #455DA7;
border: 2px solid transparent;
}
label input[type=checkbox]:checked + .cb-icon::before {
display: block;
}
label .cb-icon {
width: 16px;
height: 16px;
display: block;
position: relative;
border-radius: 4px;
border: 2px solid #455DA7;
transition: all 0.5s ease;
}
label .cb-icon::before {
content: "";
top: 0px;
left: 5px;
width: 4px;
height: 10px;
display: none;
position: absolute;
transform: rotate(45deg);
transition: all 0.5s ease;
border-top: 0px solid transparent;
border-right: 3px solid #fff;
border-bottom: 3px solid #fff;
border-left: 0px solid transparent;
}
<label>
<input type="checkbox" name="" />
<span class="cb-icon"></span>
</label>
<label>
<input type="checkbox" name="" />
<span class="cb-icon"></span>
</label>
我这里有一个多 select 列表,如下所示。
但我无法更改 CSS。这是到目前为止我已经尝试过的代码,我能够获得轮廓颜色,内部刻度无法看到它。
input[type=checkbox], input[type=radio] {
margin: 4px 0 0;
margin-top: 1px;
height: 16px;
border-radius: 2px;
line-height: normal;
box-shadow: none;
outline-offset: -1px;
-webkit-appearance: none;
width: 16px !important;
margin: 5px;
appearance:none;
outline: 2px solid #455eab;
font-size: 2em;
}
.form-check-input{
width: 35px;
}
input[type="checkbox"]:checked ~ label::before {
color: #455eab;
}
<input class="form-check-input"[checked]=true type="checkbox">
<input class="form-check-input" type="checkbox" >
<input class="form-check-input" type="checkbox" >
<input class="form-check-input" type="checkbox" >
你是那个意思吗?
label {
cursor: pointer;
display: inline-block;
}
label input[type=checkbox] {
display: none;
}
label input[type=checkbox]:checked + .cb-icon {
background: #455DA7;
border: 2px solid transparent;
}
label input[type=checkbox]:checked + .cb-icon::before {
display: block;
}
label .cb-icon {
width: 16px;
height: 16px;
display: block;
position: relative;
border-radius: 4px;
border: 2px solid #455DA7;
transition: all 0.5s ease;
}
label .cb-icon::before {
content: "";
top: 0px;
left: 5px;
width: 4px;
height: 10px;
display: none;
position: absolute;
transform: rotate(45deg);
transition: all 0.5s ease;
border-top: 0px solid transparent;
border-right: 3px solid #fff;
border-bottom: 3px solid #fff;
border-left: 0px solid transparent;
}
<label>
<input type="checkbox" name="" />
<span class="cb-icon"></span>
</label>
<label>
<input type="checkbox" name="" />
<span class="cb-icon"></span>
</label>