是否可以将图像放入input type ="复选框"?

san*_*eep 13 html css checkbox

我想在我的HTML代码中的复选框和单选框的背景上放置一个图像,但它不起作用,但它可以在其他表单属性上工作.

san*_*eep 18

我找到了如何使用纯css 将图像赋予复选框单选按钮.

HTML

<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label>
Run Code Online (Sandbox Code Playgroud)

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;
}
Run Code Online (Sandbox Code Playgroud)

请查看此更多信息http://css-tricks.com/the-checkbox-hack/,

https://gist.github.com/592332