HTML and CSS Reference
In-Depth Information
user can't resize it. Both attributes require integer values for the re-
spective dimension's size in characters. The browser automatically
scrolls text that exceeds either dimension.
9.7.1.2. The wrap attribute
Normally, the browser sends the text that you type into the text area
to the server exactly as typed, with lines broken only where the user
pressed the Enter key. Because this is often not the action the user de-
sired, you can enable word wrapping within the text area. When the user
types a line that is longer than the width of the text area, the browser
automatically moves the extra text down to the next line, breaking the
line at the nearest point between words in the line.
With the
wrap
attribute set to
virtual
, the text is wrapped within the
text area for presentation to the user, but is transmitted to the server
as though no wrapping had occurred except where the user pressed the
Enter key.
With the
wrap
attribute set to
physical
, the text is wrapped within the
text area and is transmitted to the server as though the user had ac-
tually typed it that way. This is the most useful way to use word wrap
because the text is transmitted exactly as the user sees it in the text
area.
To obtain the default action, set the
wrap
attribute to
off
.
As an example, consider the following 60 characters of text that are be-
ing typed into a 40-character-wide text area:
Word wrapping is a feature that makes life easier for users.
With
wrap=off
, the text area contains one line and the user must scroll
to the right to see all of the text. One line of text is transmitted to the
server.