Issue
I have a project where sometimes checkboxes don't have labels. The only way of setting custom image for checkbox I've found was setting image for label:before
for corresponding label
which has for
value with id
of checkbox.
Are there any CSS way (at least hacky) to set custom image to checkbox without changing markup? input[type="checkbox"]:before
works only in Chrome.
Solution
The only way I've found that works everywhere except IE is via setting CSS appearance
:
input[type="checkbox"] {
width: 16px;
height: 16px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: red;
}
input[type="checkbox"]:checked {
background-color: green;
}
<input type="checkbox" />
Answered By - Vadim Ovchinnikov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.