is it possible put image in input type=“check box”?

前端 未结 3 1305
轻奢々
轻奢々 2020-12-01 19:02

i want to put an image on the background of check box & radio box in my html code but it\'s not work but it\'s work on other form property.

3条回答
  •  执笔经年
    2020-12-01 19:10

    I found the way how give image to checkbox & radio button with pure css.

    HTML

    
    

    CSS

    input[type=checkbox] {
        display:none;
    }
    
    input[type=checkbox] + label {
        background: #999;
        height: 16px;
        width: 16px;
        display:inline-block;
        padding: 0 0 0 0px;
    }
    
    input[type=checkbox]:checked + label {
        background: #0080FF;
        height: 16px;
        width: 16px;
        display:inline-block;
        padding: 0 0 0 0px;
    }
    

    Check this for more http://css-tricks.com/the-checkbox-hack/ ,

    https://gist.github.com/592332

提交回复
热议问题