The role of label

Source: Internet
Author: User

Definition and usage

The <label> tag defines the callout (tag) for the INPUT element.

The label element does not present any special effects to the user. However, it improves usability for the user of the mouse. This control is triggered if you tap text inside a LABEL element. That is, when the user selects the label, the browser automatically shifts the focus to the label-related form controls.

The For property of the <label> tag should be the same as the id attribute of the related element.

--------------------------------------------------------------------------------------------------------------- ------------------

I didn't know what I was talking about at the finish.

Finally, here's the question of the accessibility of label tags in HTML5 see examples to understand: is to make the user in the choice of time easier, click on the text of the selection box can be checked on the selected option.

In HTML5, you can use the label label in 3 ways:

associating controls with for and IDs

<p><label for= "Test" > Label </label> <input name= "input" type= "text" id= "test"/></p>

Label Label Wrapping Control

<p><label> label <input name= "Input" type= "text"/></label></p>

- pronged approach

<p><label for= "test2" > Label <input name= "Input" type= "text" id= "Test2"/></label></p>

However, the accessibility of the format using the For + ID is better than the form of inclusion, so in everyday use it is best to use the For + ID form.

The role of label

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.