Attribute for <TEXTAREA ...>
WRAP = SOFT | HARD | OFF

Usage Recommendation
use it, but don't rely on it

WRAP describes how the text in the text area should wrap at the end of lines. Until this attribute came along, browsers generally did not do word wrapping. If you typed a line that was longer than the display area, the line just kept going, hopefully with the display area scrolling along. This was not the way people are used to entering text, so Netscape added the WRAP attribute.

SOFT wraps long lines in the text area for easy editing, much like a word processor. It does not, however, send the carriage returns to the server. This type of wrap is probably the most useful because it is the easiest for the user to edit, but it does not actually change any of their data. HARD looks to the user like SOFT, but the carriage returns the user sees are sent to the server. OFF does not wrap at all; it displays and sends the text exactly as typed in.

this code produces this
<TEXTAREA NAME="SOFT" COLS=25 ROWS=5 WRAP=SOFT>
<TEXTAREA NAME="HARD" COLS=25 ROWS=5 WRAP=HARD>
<TEXTAREA NAME="OFF" COLS=25 ROWS=5 WRAP=OFF>
Default behaviour differs between browsers
<TEXTAREA NAME="NONE" COLS=25 ROWS=5>
 

You may from time to time see other variations on WRAP, such as VIRTUAL or PHYSICAL. Netscape introduced these attributes a few years ago as proposed extensions to HTML 3.0, then abandoned them. Officially, the HTML 4.0 specs don't list WRAP, but Netscape and MSIE list WRAP = HARD | SOFT | OFF in their guides. It's best to stick these three values.




About the Author
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.