Html-label-tag
提供:Dev Guides
HTML-<label>タグ
説明
HTML <label>タグは、テキスト、テキストエリアなどのフォームコントロールにラベルを追加するために使用されます。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML label Tag</title>
</head>
<body>
<label for = "email">EMAIL-ID:<br/>
<input type = "email" value = "" name = "emailid"
size = "30" placeholder = "Enter a valid email address">
<br/>
<br/>
<label for = "phone">PHONE NO:<br/>
<input type = "text" value = "" name = "phno"
size = "30" maxlength = "10" placeholder = "Enter a valid phone number"
pattern = "[0-9]{10}">
<br/>
<br/>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <label>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
formhtml-5 | form_id | It specifies one or more forms the label belongs to |
for | control id | Specifies the input control that this label is for. This value must be the same as the value in the input control’s "id" attribute. |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |