Skip to content

Instantly share code, notes, and snippets.

@causztic
Created January 9, 2020 05:07
Show Gist options
  • Save causztic/8d85bc35acfc8a93a82aa6408e9af59e to your computer and use it in GitHub Desktop.
Save causztic/8d85bc35acfc8a93a82aa6408e9af59e to your computer and use it in GitHub Desktop.
Highlight label for radio buttons when selected with only CSS
input:checked + label {
color:red;
font-weight: bold;
}
<div>
<input id="radio-1" name="food" type="radio" value="broccoli">
<label for="radio-1">Broccoli</label>
<br />
<input id="radio-2" name="food" type="radio" value="burger">
<label for="radio-2">Burger</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment