Home  >  Article  >  Web Front-end  >  What is the label of html?

What is the label of html?

藏色散人
藏色散人Original
2021-02-25 11:22:0613666browse

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.

What is the label of html?

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.

What is the label of html?

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:

What is the label of html?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What are htm and htmlNext article:What are htm and html