How do older browsers (IE8 and below) customize the style of checkboxes and check boxes?

Web page production requirements will always encounter the need to beautify the check box, the usual method is to use the for attribute of the label tag to bind to the check box, hide the input tag, and customize the check box style by setting the style of label and input:checked + label.

but this is not compatible with older browsers. In order to be compatible, my current practice is to add click time to label and add class= "checked" to the selected state, but this seems to have nothing to do with input, and there will be new performance problems.

if you don"t use the input tag, it can be troublesome to submit a form, so what should you do with this requirement without abandoning an earlier version of the browser?

Mar.01,2021

css selector cannot do this, it can only be done through js, that is, event binding and handling

Menu