HTML label for properties
Examples
Two radio buttons with the label:
<form action="demo_form.html">
<label for="male">Male</label>
<input type="radio" name="sex" id="male" value="male"><br>
<label for="female">Female</label>
<input type="radio" name="sex" id="female" value="female"><br>
<input type="submit" value="提交">
</form>
<label for="male">Male</label>
<input type="radio" name="sex" id="male" value="male"><br>
<label for="female">Female</label>
<input type="radio" name="sex" id="female" value="female"><br>
<input type="submit" value="提交">
</form>
try it"
Browser Support
All major browsers support for attributes.
Definition and Usage
for attribute specifies the form element label binding.
Differences between HTML 4.01 and HTML5
no.
grammar
<label for="element_id">
Property Value
值 | 描述 |
---|---|
element_id | label 绑定的元素的 id。 |
HTML <label> tag