HTML <label> para atributo
Exemplo
Três botões de opção com rótulos:
<form action="/action_page.php">
<input type="radio" id="html" name="fav_language" value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css"
name="fav_language" value="CSS">
<label for="css">CSS</label><br>
<input type="radio" id="javascript" name="fav_language" value="JavaScript">
<label for="javascript">JavaScript</label><br><br>
<input
type="submit" value="Submit">
</form>
Definição e uso
O for
atributo especifica a qual elemento de formulário um rótulo está vinculado.
Suporte ao navegador
Attribute | |||||
---|---|---|---|---|---|
for | Yes | Yes | Yes | Yes | Yes |
Sintaxe
<label for="element_id">
Valores de atributo
Value | Description |
---|---|
element_id | The id of the element the label is bound to |
❮ Tag HTML <label>