label tag in form
The label label in the form
My friends, when you were studying the various controls of the form, did you find a label-label? The following section will reveal its function. The
label label does not present any special effects to the user; its purpose is to improve usability for mouse users. This control will be triggered if you click on the text inside the label. That is to say, when the user clicks to select the label, the browser will automatically turn the focus to the form control related to the label (it will automatically select the form control related to the label).
Syntax:
<label for="控件id名称">
Note: The value in the for attribute of the tag should be the same as the id attribute value of the related control It must be the same.
Example:
<form> <label for="male">男</label> <input type="radio" name="gender" id="male" /> <br /> <label for="female">女</label> <input type="radio" name="gender" id="female" /> <label for="email">输入你的邮箱地址</label> <input type="email" id="email" placeholder="Enter email"> </form>