Home >Web Front-end >Front-end Q&A >Which html elements have the for attribute
HTML elements with for attributes: 1. label element; when for is used with the label element, the for attribute specifies which form element the label is bound to. 2. Output element; when for is used with the output element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
HTML elements to which the for attribute applies
Element name | Description |
---|---|
When for is used with the 2e1cf0710519d5598b1f0f14c36ba674 element, for Property specifies which form element the label is bound to. | |
When used with the be6d67dae90cc1ad6469079e163d0939 element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation. |
##2e1cf0710519d5598b1f0f14c36ba674label for attributeThe for attribute specifies which form element the label is bound to .
Syntax<label for="element_id">
element_id: label The id of the element to be bound.
<form action="/jc_script/action.php">
<label for="php">PHP</label>
<input type="radio" name="lang" id="php" value="php"><br>
<label for="java">Java</label>
<input type="radio" name="lang" id="java" value="java"><br>
<label for="python">Python</label>
<input type="radio" name="lang" id="python" value="python"><br><br>
<input type="submit" value="提交">
</form>
be6d67dae90cc1ad6469079e163d0939Tag for attributefor attribute specifies the calculation result Relationship to elements used in calculations.
Grammar<output for="element_id">
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100
+<input type="number" id="b" value="50">
=<output name="x" for="a b"></output>
</form>
Recommended tutorial: "
The above is the detailed content of Which html elements have the for attribute. For more information, please follow other related articles on the PHP Chinese website!