Home >Web Front-end >HTML Tutorial >label's for attribute_html/css_WEB-ITnose

label's for attribute_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:43:241176browse

1. Introduction to use

2e1cf0710519d5598b1f0f14c36ba674 is specially designed to serve input elements and define tags for them.

The for attribute specifies which form element the label is bound to

There are two ways to bind the label to the form control:

1. Use the form control as the content of the label, like this It's the hermit binding.

The for attribute is not needed at this time, and the bound control does not need the id attribute.

隐式绑定:<label>Date of Birth: <input type="text" name="DofB" /></label>

2. Name the id of the target form for the for attribute under the 2e1cf0710519d5598b1f0f14c36ba674 tag. This is real binding.

显式绑定:<label for="SSN">Social Security Number:</label><input type="text" name="SocSecNum" id="SSN" />

2. Why should we add the for attribute to 2e1cf0710519d5598b1f0f14c36ba674?

Adding the for attribute to 2e1cf0710519d5598b1f0f14c36ba674 and binding the input control can improve the user experience of mouse users. experience.

This control will be triggered if the text is clicked within the label element. That is, when the user renders the label, the browser will automatically turn focus to the form control related to the label.

Blog Park Team: Sorry! Paiyun is out of order again, and now I can't upload pictures. 09:35

Hey, I couldn’t upload it last night, so I won’t upload the picture.

Blog Park Team: Due to Paiyun failure again, we are switching the image upload back to our server 2015-06-02 10:10

The efficiency is quite high.

html5 adds a new form attribute to 2e1cf0710519d5598b1f0f14c36ba674 to specify one or more forms to which the label belongs. Multiple forms are separated by spaces. Haven't really used it yet, need to supplement.

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