A label is a placeholder for text and other UI elements.
Label is a commonly used term for a user interface element. It is applicable to both web, and windows environment. It is typically an element with limited functionality, used solely, or at least primarily, for display purposes.
It can also have additional roles such as providing hooks for accessibility and assistive technologies. The HTML label tag is often used for this purpose.
Definition and Usage
- The
<label>
tag defines a label for an element. - The
<label>
element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the<label>
element, it toggles the control. - The for attribute of the
<label>
tag should be equal to the id attribute of the related element to bind them together. - The for attribute specifies which form element a label is bound to.