Created
January 9, 2020 05:07
-
-
Save causztic/8d85bc35acfc8a93a82aa6408e9af59e to your computer and use it in GitHub Desktop.
Highlight label for radio buttons when selected with only CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input:checked + label { | |
color:red; | |
font-weight: bold; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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