HTML <label>
query_builder | Christopher PisaniThe HTML element <label> represents a caption for specific elements, that include the <input>,<meter>,<progress>,<select> and <textarea> elements. Using this element will widen the area for elements with a selection, and is also benifical to use for users with screen readers, as it will read the label when hovered over the related elements bound to them.
<div class="preference">
<label for="cheese">Do you like cheese?</label>
<input type="checkbox" name="cheese" id="cheese">
</div>
<div class="preference">
<label for="peas">Do you like peas?</label>
<input type="checkbox" name="peas" id="peas">
</div>
Available Attributes
Attribute | Values | Functionality |
---|---|---|
for | element id | The id of the associated element |
form | form id | The id of the associated form |