Checkbox Hack with :checked pseudo selector
Milap Patel
Technical Manager | Node.js | React | JavaScript | AWS Certified Cloud Practitioner | PHP | WordPress | Front-end | MongoDB | MySQL
The :checked pseudo-class in CSS selects elements when they are in the selected state. It is only associated with input elements of type radio and checkbox.
The “Checkbox Hack” is where you use a connected label and input type=”checkbox” and usually some other element you are trying to control.
Examples for Checkbox hack on Codepen: