Web Design

(Nancy Kaufman) #1

257


CHAPTER

Adding Forms to Your Site 11


TIP


If it does not change the appearance of the form, why should I use the <label> tag?
Using the tag improves the accessibility of the form, because screen readers for blind users can more easily
associate the text with the form field if the tag is present. The tag also simplifies styling the form’s labels
because they will all have a consistent tag that can be used as a selector in your CSS. Modern browsers
allow users to click on labels if they are in the tag to place the cursor in the form field.

When viewed in the browser,
the form appears as it did
before.


3 Before the text being used as
the field’s label, type
<label for=”?”>,
replacing? with the ID you
used in Step 2.
4 After the label text, type
</label>.

3 4

Free download pdf