Answer the question
In order to leave comments, you need to log in
How to style type="checkbox" cross-browser?
Hello!
Please tell me how to make such a checkbox cross-browser:
I tried in different ways, googled, but something did not work out very well.
There is only 1 checkbox on the page, but it is very nasty, so I have been racking my brain for more than an hour! :))
I will be very grateful to you for your help! :)
Answer the question
In order to leave comments, you need to log in
Make a label for the checkbox, hide the checkbox itself, add the necessary styles for the label through :before. (when checkbox:checked and checkbox are in the normal state, but the order of the tags in the code is important). A similar method was described on habrahabr.
Pseudocode:
<input type="checkbox" id="checkbox"><label for="checkbox">Test</label>
<style>
#checkbox {
display: none;
}
#checkbox:checked + label:before {
content: "* ";
}
#checkbox + label:before {
content: " ";
}
</style>
It is strange, of course, that, according to you, Gogle has a day off today).
Here's a heading in the right direction for the label
<labe for="test">Test</label>
<input type="чекбокс" id="test">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question