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

label's for attribute_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:43:24
Original
1189 people have browsed it

1. Introduction to use

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>
Copy after login

2. Name the id of the target form for the for attribute under the

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

2. Why should we add the for attribute to
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template