Web Design

(Nancy Kaufman) #1

255


CHAPTER

Adding Forms to Your Site 11


● The text field appears and is
editable when the page is
viewed in a browser.

5 Type name=”?”, replacing?
with a name for the field.


6 Type />.


6


5


TIPS


Can I change the size of the field?
Yes. You can use the HTML size attribute to set
the field’s width. The attribute takes as its value a
number, theoretically set to the number of
characters that will display in the field. You can also
use the CSS width property. See Chapter 4 for more
about CSS.

Can I restrict how much text a user can add to
the field?
Yes. Adding the maxlength attribute of the
<input> tag restricts the user to entering only
the specified number of characters into the field.
You can also specify a value attribute to
prepopulate the field with text.
Free download pdf