News for hackers. Stuff that matters.
Re:HTML and CSS techniques to reduce your JavaScript by runarberg on Friday June 04, 2021 @01:09PM (#27395893)
Custom radio buttons and checkboxes are remarkably easy if you style the <input> it self using `appearance: none`. With multiple background images and masks there is really no need for a complicated sibling selectors and <label> setup:

    <label>
      <input type="checkbox">
      <span class="label">Some label</span>
    </label>

    input[type="checkbox"] {
      appearance: none;
      /* ... */
    }

    input[type="checkbox"]:checked { /* ... */ }
    input[type="checkbox"]:indeterminate { /* ... */ }
    input[type="checkbox"]:disabled { /* ... */ }
Re:HTML and CSS techniques to reduce your JavaScript by extra88 on Friday June 04, 2021 @02:27PM (#27397145)
That's good to keep in mind. No IE support for `appearance` but it can be used in such a way that it's just a more ordinary input in that browser.

There are still more things you can do within a label. This is a good article on improving methods of visually hiding the actual inputs.

https://www.sarasoueidan.com/blog/inclusively-hiding-and-sty...