Attach a label to an input field

label

A label is a brief textual identifier for an input field.

Each label is associated with one form field using the "for" attribute. Alternatively, a form field can be associated with a label by making it subordinate to the label.

Clicking on the label automatically places the focus on its associated field. Also, assistive technology can be employed to read the label aloud.

Properties

for
The ID of the element to be associated with this label.

Examples

form {
label *for=your-name Your full name
input #your-name *name=your-name *type=text
}
Association using the for attribute

form {
label Your full name {
input *name=your-name *type=text
}
}
Association through subordinate placement

semantax > input-output > labelAttach a label to an input field

🔎