Learn the use of label labels in Web pages

Source: Internet
Author: User
Tags reference
Web page

Using LABEL objects

The HTML 4.0 specification introduces a LABEL object that you can use to associate text with any other HTML object or internal control. The linked label and HTML object behave consistently when the event is raised and received, regardless of whether the user clicks a label or an HTML object. To link label and HTML objects, set the label's for property to equal the ID property of the HTML object.

The following example associates a LABEL control with a text box. When the user clicks a Label control (or presses the ALT+T key combination), the label control sets the focus to the text box:

 
  
  
The following is a reference fragment:

<input type= "text" id= "Txtinputbox" name= "Txtinputbox" accesskey= "T"/>
Labels are designed primarily to add accessibility to form components, and we typically use labels in the form. In addition to the above methods, you can embed the entire form component and the text label directly with a label, as in the following example:
 
  
  
The following is a reference fragment:










</form>

Under SpecificationThis allows the text to be automatically associated with the adjacent form component, which unfortunately is not supported by IE.

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.