HTML tag
##All major browsers support the
tag.
Safari 2 or earlier does not support the label.
Definition and usage (Recommended learning: HTML introductory tutorial)
The label defines the label for the input element (mark ). 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 to say, when the user selects the label, the browser will automatically turn the focus to the form control related to the label.
The for attribute of the label should be the same as the id attribute of the related element.
Tips
Note: The "for" attribute can bind the label to another element. Please set the value of the "for" attribute to the value of the id attribute of the relevant element.
Example
Simple HTML form with two input fields and associated tags:
<html>
<body>
<p>请点击文本标记之一,就可以触发相关控件:</p>
<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="female" />
</form>
</body>
</html> Copy after login
The above is the detailed content of HTML tag. For more information, please follow other related articles on the PHP Chinese website!