HTML and CSS Reference
In-Depth Information
where
type
is either
hard
or
soft
. In a hard wrap, information about where the text
begins a new line is included with the data field value, while in a soft wrap this infor-
mation is not included. When a hard wrap is used, the
cols
attribute also needs to
be specified. Many browsers also support the
off
wrap type to prevent browsers from
wrapping text within a text area box, though it is not part of any HTML specification. The
default value of the
wrap
attribute is
soft
.
Creating a Text Area Box
• To create a text area box for multiple lines of text, use the element
<textarea name=”
name
”>
text
</textarea>
where
name
is the name of the field associated with the text area box and
text
is the
default text that appears in the box.
• To specify the dimensions of the box, add the attributes
rows=”
value
” cols=”
value
”
to the
textarea
element, where the
rows
attribute specifies the number of lines in
the text area box and the
cols
attribute specifies the number of characters per line.
• To specify how the field value should handle wrapped text, use the attribute
wrap=”
type
”
where
type
is either
hard
(to include the locations of the line wraps) or
soft
(to
ignore line wrap locations).
You'll add a
textarea
element to the survey form to store the customer comments.
You'll also set the width and the height of the element using a CSS style rule.
To create the comments text area box:
◗
1.
Return to the
survey.htm
file in your text editor.
◗
2.
Directly below the
fieldset
element for the
foodHot
option group you just cre-
ated, enter the following code (see Figure 6-42):
<label for=”comments”>Tell us more about your experience!</label>
<textarea name=”comments” id=”comments”></textarea>
figure 6-42
creating a text area control
comments field