You are here

Using the HTML5 <label> element correctly

The HTML5 <label> element allows an author to establish a relationship between a text node and a field in an HTML form. The reference is made by assigning the ID attribute of the form control (e.g., text input, select, checkbox, etc) to the FOR attribute of the corresponding label. The label is not extensible and serves no other purpose.

This issue pertains to all interactive form elements, but is frequently noted in search utilities. In the case of Search elements, the placeholder attribute is not sufficient as a label or reference to the form control; you must one of the following techniques to label your search field