Home >Web Front-end >Front-end Q&A >What is the label of html?
html's label is a label used to define labels or tags for input elements; the label element does not present any special effects to the user; however, it improves usability for mouse users. If the user is within the label element Clicking on the text will trigger this control.
The operating environment of this article: Windows7 system, HTML5, Dell G3 computer
label definition and usage
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.
Tips and Notes:
Note: The "for" attribute can bind label to another element. Please set the value of the "for" attribute to the value of the id attribute of the relevant element.
Attribute
new: New attribute in HTML5.
Note:
All major browsers support the
Safari 2 or earlier does not support the
[Recommended: HTML video tutorial]
Example
Simple HTML with two input fields and related tags Form:
<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>
Running effect:
The above is the detailed content of What is the label of html?. For more information, please follow other related articles on the PHP Chinese website!