HTML and CSS Reference
In-Depth Information
Creating a Field Label
• To explicitly associate a text label with a control element, use the label element and
the for attribute
<label for=” id ”> label text </label>
where id is the id of the control element.
• To implicitly associate a text label with a control element, nest the control element
within the label element as follows
<label>
label text
control
</label>
where control is the control element. You do not have to include a for attribute.
You'll use the label element and the for attribute to associate the descriptive text
you've entered in the survey form with the relevant input boxes.
To apply the field labels:
1. Return to the survey.htm file in your text editor.
2. Go to the customer information field set and enclose the text string Name * within
a label element, associating it with the custname input box as follows:
<label for=”custname”>Name *</label>
3. Repeat this process for the remaining descriptive text strings in the two field sets,
using the for attribute to associate each label with the corresponding input box.
Figure 6-15 shows the revised code in the file, highlighting the different values of
the for attribute.
Search WWH ::




Custom Search