HTML Tutorial
<label>
The <label>
tag is used to provide a clickable caption for various form elements, such as input fields, checkboxes, and radio buttons. When the <label>
tag is clicked, it triggers the associated form element, allowing users to input information or select options.
<label>
<label>
<label for="username">Username:</label>
<label for="agree">I agree to the terms and conditions</label>
<label for="male">Male</label>
Exploring the <label>
Tag
Here's a simple HTML example that demonstrates the usage of the <label>
tag:
<form>
<label for="name">Name:</label>
<input type="text" id="name">
<br>
<label for="email">Email:</label>
<input type="email" id="email">
<br>
<input type="submit" value="Submit">
</form>
In this example, the <label>
tags provide user-friendly captions for the input fields. By clicking on the labels, users can easily input their name and email address into the corresponding fields.