Home Tutorials HTML Tutorial Labels
Labels

Labels


27. Labels

The <label> element gives an accessible caption to form controls. It improves usability, especially when associated with the control by for and id.

Syntax

<label for="username">Username</label>
<input id="username" type="text">

Example

<label for="email">Email:</label>
<input id="email" type="email">

Output

The label Email: appears next to or above the email input field.
Example

🏋️ Test Yourself With Exercises

Take our quiz on Labels to test your knowledge.

Browse Quizzes »