Video is not available... Embedded is previous playlist.
Notice the use of the <label>
element in the example above.
The <label>
tag defines a label for many form elements.
The <label>
element is useful for screen-reader users, because the screen-reader will read out loud the label when the user focuses on the input element.
The <label>
element also helps users who have difficulty clicking on very small regions (such as radio buttons or checkboxes) - because when the user clicks the text within the <label>
element, it toggles the radio button/checkbox.
The for
attribute of the <label>
tag should be equal to the id
attribute of the <input>
element to bind them together.
<!DOCTYPE html>
<html>
<body>
<h2>Label Elements</h2>
<form>
<label for="fname">First name:</label>
<label for="lname">Last name:</label>
</form>
</body>
</html>