Current location - Loan Platform Complete Network - Big data management - html tag question: what does the for attribute of lable do?
html tag question: what does the for attribute of lable do?
The element defines annotation (labeling).

The label element does not present any special effects to the user. However, it improves usability for mouse users. This control is triggered if you click on the text inside the label element. That is, when the user selects the label, the browser automatically shifts focus to the form control associated with the label.

<label> The for attribute of the label should be the same as the id attribute of the associated element.

Example

Simple HTML form with two input fields and associated tags:

<form>

<label for="male">Male</label>

<input type=" radio" name="sex" id="male" />

<br />

<label for="female">Female</label>

<input type="radio" name="sex" id="male" />

<input type="radio" name="sex" id="female" />

</form>