Labeling Checkboxes and Radio Buttons


#1

Why each of the Radio Buttons and Checkboxes needs nested within their own label elements? And what happens if we do not use the label elements?


#2

You’ve got good questions today. :slight_smile:

You don’t technically need to put the input within it’s own label field, but each input should have a label field… and we’ve been doing it that way for so long that it’s a bit of a standard practice.

The labels, when used right, allow for a bigger click target. So, instead of trying to click on a tiny little radio button or checkbox, we can click on the label and it will select that input (any input… even regular text inputs).

There are some other cool accessibility features of labels you learn about as you progress, but here’s the most important part for your question: How do you know what each radio/checkbox is?

Labels tell us what all these pieces do. :wink:


#3

Thanks again boss-man.