HTML labels
giving each form field a label
Looking closer into the <form>
at our fields and their labels:
Above most form fields, we have a <label>
tag that points to each of those fields, with the for
attribute:
The "First name" label matches the
<input>
field that has the namefname
The "Last name" label matches the
<input>
field that has the namelname
The "Gender" label matches the
<select>
field that has the namegender
Also note that the input
field with the type
of submit (i.e. a button) does not need a label as the text in the value
attribute serves as the label!
Last updated