Css改變radio樣式

結構:

<div class="c_radio">
   <input type="radio" id="1" name="radio11">
   <label for="1"></label>
   <label for="1" class="lb_text">紅色</label>
</div>

css:

.c_radio {
    height: 35px;
    line-height: 35px;
}

.c_radio > input {
    display: none;
}

.c_radio label {
    vertical-align: middle;
    line-height: 20px;
    display: inline-block;
    height: 20px;
}
label.lb_text{
    margin-left:5px;
}

.c_radio > input:checked + label::before {
    border: 1px solid #57b5e3;
}

.c_radio > input:checked + label::after {
    display: block;
}

.c_radio > input + label {
    position: relative;
    cursor: pointer;
    vertical-align: middle;
}

.c_radio > input + label::before {
    border-radius: 50%;
    position: relative;
    top: 0;
    left: 0;
    display: inline-block;
    width: 20px;
    height: 20px;
    content: '';
    border: 1px solid #c0c0c0;
}

.c_radio > input + label::after {
    content: "";
    display: none;
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34adeb;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章