纯CSS的CheckBox

废话不多说 贴代码

.limits {
    padding: 20px 50px 0px;
}
.limits section{
    padding: 0px 50px;
}

.limits input[type=checkbox] {
    visibility: hidden;
}

    .limits .checkbox {
        width: 15px;
        height: 15px;
        background-color: #5A8BFF !important;
        position: relative !important;
        border: 1px solid #5A8BFF !important;
        display: inline-block;
        margin: 0 !important;
        top: 2px;
    }


    .limits .checkbox label {
        position: absolute !important;
        width: 15px !important;
        height: 15px !important;
        background: #fff !important;
        left: 0 !important;
        cursor: pointer !important;
        transition: all .5s ease-in !important;
        padding:0!important;
    }

.limits input[type=checkbox]:checked + label {
    background-color: #5A8BFF !important;
}

    .limits input[type=checkbox]:checked + label:after {
        content: '\00a0' !important;
        display: inline-block !important;
        border: 2px solid #fff !important;
        border-top-width: 0 !important;
        border-right-width: 0 !important;
        width: 9px !important;
        height: 5px !important;
        -webkit-transform: rotate(-50deg) !important;
        position: absolute !important;
        top: 3px !important;
        left: 3px !important;
        z-index: 1 !important;
    }

.limits input[type=checkbox] + label:after {
    content: '\00a0' !important;
    display: inline-block !important;
    border: 2px solid #5A8BFF !important;
    border-top-width: 0 !important;
    border-right-width: 0 !important;
    width: 9px !important;
    height: 5px !important;
    -webkit-transform: rotate(-50deg) !important;
    position: absolute !important;
    top: 3px !important;
    left: 3px !important;
    z-index: 1 !important;
}

<div class="limits">
    <div class="checkbox">
        <input type="checkbox" name="FishBaseID" id="id" value=""><label for="id">label>
    div>
div>

纯CSS的CheckBox_第1张图片


注释掉这一段

.limits input[type=checkbox] + label:after {
    content: '\00a0' !important;
    display: inline-block !important;
    border: 2px solid #5A8BFF !important;
    border-top-width: 0 !important;
    border-right-width: 0 !important;
    width: 9px !important;
    height: 5px !important;
    -webkit-transform: rotate(-50deg) !important;
    position: absolute !important;
    top: 3px !important;
    left: 3px !important;
    z-index: 1 !important;
}

就是纯CSS的CheckBox_第2张图片

你可能感兴趣的:(css,html,CheckBox)