Home / CSS Tips Generated By ChatGPT / Styling Based on Checkbox State in CSS Style elements based on the checked state of a checkbox, useful for creating toggle switches or custom checkbox designs. Source Code input[type="checkbox"]:checked + label { background-color: #4CAF50; color: white; }