原生 input checkbox 样式修改

737 阅读1分钟
input[type="checkbox"]{
    -webkit-appearance: none;
    vertical-align:middle;
    margin-top:0;
    background:#fff;
    border:#999 solid 1px;
    border-radius: 2px;
    min-height: 12px;
    min-width: 12px;
    position: relative;
    cursor: pointer;
}
input[type="checkbox"]:checked {
    //background: var(--el-color-primary);  //element  全局默认颜色
    background:#409eff;
    border: none;
}
input[type=checkbox]:checked::after{
    content: '';
    top: 4px;
    left: 2px;
    position: absolute;
    background: transparent;
    border: #fff solid 1px;
    border-top: none;
    border-right: none;
    height: 4px;
    width: 8px;
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -webkit-transform: rotate(-45deg); 
    transform: rotate(-45deg);
}