css实现单选按钮多选按钮

1、css实现单选按钮样式


 <div class="choose">
 <label class="radio">选项1<input type="radio" name="radio" value="1" checked><i></i></label>
 <label class="radio">选项2<input type="radio" value="2" name="radio"><i></i></label>
</div>
<style>
.choose {
    position: relative;
}

.choose .radio {
    position: relative;
    display: inline-block;
    font-weight: 400;
    color: #0c4757;
    padding-left: 25px;
    cursor: pointer;
}

.choose .radio input {
    position: absolute;
    left: 0px;
}

.choose .radio i {
    display: block;
    position: absolute;
    top: 30px;
    left: 0;
    width: 15px;
    height: 15px;
    outline: 0;
    border: 1px solid #e4e4e4;
    background: #ffffff;
    border-radius: 50%;
    transition: border-color .3s;
    -webkit-transition: border-color .3s;
}

.choose .radio input + i:after {
    position: absolute;
    content: '';
    top: 4px;
    left: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #00FF00;
    opacity: 0;
    transition: opacity .1s;
    -webkit-transition: opacity .1s;
}

.choose .radio input:checked + i:after {
    opacity: 1;
}

</style>

2、css实现多选

多选的对勾使用字体

猜你喜欢

转载自blog.csdn.net/weixin_43224306/article/details/85697464