XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / label
(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
label
HTML 4.01 | HTML 5 |
<label> ... </label>
Used to provide additional information about controls. Each labelrefers to exactly one form element. The associated form element can be nested inside the label element. Otherwise, the attribute for is used with the ID of the associated form element.
Notes
In HTML 5, a label can contain the input element and use the for/id method.
Start/end tag
Required/required
Attributes
Core, internationalization, events, focus, global HTML 5 attributes
for="Text"Associates the
labelexplicitly with a control. The attributeforcontains the value of theidattribute of the form element for which thelabelis intended.form="ID des übergeordneten Formulars"Associates the
labelexplicitly with a specific parent form. With this method, thelabeldoes not necessarily have to be nested inside the correspondingformelement.
Examples
A form in which the input element is nested inside the label element:
<label>Nachname: <input type="text" size="32"></label>
Using the for/id method to associate a label with the corresponding input form element:
<label for="Nachname">Nachname:</label>
<input type="text" id="Nachname" size="32">
|
Copyright © 2010 O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from "HTML & XHTML ─ kurz & gut" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de