what are <label> tags? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what are <label> tags?

can someone explain the use of html label tags?

17th Feb 2017, 11:21 AM
Fire
2 Answers
+ 2
<input type="checkbox" id="mychkbx"><label for="mychkbx">click me and I check the box</label> Try this snippet with and without the <label> tags, and you will see ;) Accessory, the <label> and it's target don't require to be siblings ( but logically, they have to be visually close ^^ )
17th Feb 2017, 9:14 PM
visph
visph - avatar
+ 1
They are used to define a label for an <input> element. It is useful for the user as it allow to click on the label instead of, by example, the radio button.
17th Feb 2017, 1:19 PM
Benoît Depoître