css改變複選框樣式

input[type="checkbox"]{
    -webkit-appearance: none;
    top: 5px;
    float: left;
    position: relative;
    vertical-align:middle;
    margin-top:0;
    background:#fff;
    border:#999 solid 1px;
    border-radius: 3px;
    min-height: 12px;
    min-width: 12px;
}

input[type="checkbox"]:focus {
    outline: none; 
}
input[type=checkbox]:checked::after{
    content: '';
    top: 1px;
    left: 1px;
    position: absolute;
    vertical-align: middle;
    margin-top: 0;
    background: transparent;
    border: #666 solid 2px;
    border-top: none;
    border-right: none;
    height: 6px;
    width: 8px;
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -webkit-transform: rotate(-45deg); 
    transform: rotate(-45deg);
}

 

<input id="check-1" class="checkbox" name="check-1" type="checkbox" value="" />
                           <label for="check-1">複選框樣式</label>

 

發佈了26 篇原創文章 · 獲贊 39 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章