English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML label form Attribut

Die form-Attribut gibt an, zu welchem oder welchen Formulartypen das <label>-Element gehört.

 HTML <label> Tag

Online-Beispiel

Ein <label>-Element, das sich außerhalb des Formulars befindet (aber dennoch Teil desselben ist):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Verwendung des HTML-Attributs <label> for-Grundlegende Anleitung(oldtoolbag.com)</title>
</head>
<body>
<p>Die Beschriftung des ersten Radio-Buttons befindet sich außerhalb des Formulars, ist aber dennoch Teil desselben. Versuchen Sie, auf den Textbeschriftung zu klicken, um den männlichen Radio-Button umzuschalten.</p>
<form action="action_page.php" id="form1">
  <input type="radio" name="gender" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="gender" id="female" value="female"><br>
  <label for="other">Other</label>
  <input type="radio" name="gender" id="other" value="other"><br><br>
  <input type="submit" value="Submit">
</form>
<label for="male" form="form1">Male</label>
</body>
</html>
Test See ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the form attribute.

Definition and Usage

The form attribute specifies one or more forms to which the <label> element belongs.

HTML 4.01 and HTML5differences between

form attribute in HTML5 New Attribute in

Syntax

<label form="form_id">

Attribute Value

ValueDescription
form_id

Specifies the form element to which the <label> element belongs.

The value of this attribute must be the id attribute of a <form> element in the same document.

 HTML <label> Tag