HTML and CSS Reference
In-Depth Information
To create placeholders for the survey form:
◗
1.
Return to the
survey.htm
file in your text editor and scroll to the
input
element
for the
custname
field. Add the following attribute to the
<input>
tag:
placeholder=”first and last name”
◗
2.
Add the attribute
placeholder=”nnnnn (-nnnn)”
to the
input
element for the
zip
field.
◗
3.
Add the attribute
placeholder=”(nnn) nnn-nnnn”
to the
input
element for the
phone
field.
◗
4.
Finally, add the attribute
placeholder=”re-nnnnnn”
to the
input
element for
the
receipt
field. Figure 6-23 highlights the newly added code in the survey form.
figure 6-23
adding placeholders to the survey form
place
h
older text
for the phone field
◗
5.
Save your changes to the file and then refresh
survey.htm
in your Web browser.
As shown in Figure 6-24, placeholder text has been added to the
custname, zip,
phone
, and
receipt
input boxes. Notice that placeholder text is distinguished
from default text by appearing in a grayed-out font.