The area is initialized with the contents of the TEXTAREA element, using monospaced font. The contents is displayed as it is written, similarly to PRE elements.
attribute name | possible values | meaning | notes |
---|---|---|---|
NAME | string | a property name that is used to identify the textarea field when the form is submitted to the server | obligatory |
ROWS | integer | number of visible text lines | obligatory |
COLS | integer | number of visible width of text, in average character widths | obligatory |
A browser should not interpret the ROWS and COLS attributes as restricting the size of the actual input. On the contrary, the browser should provide some means to scroll through the contents of the textarea field when the contents extend the visible area.
A browser may wrap visible text lines to keep long input lines visible without need for scrolling.
The contents is used to initialize the text that is shown in the input field when the document is first loaded.
<TEXTAREA NAME=address ROWS=4 COLS=40> Your address here ... </TEXTAREA>
For single-line input fields you can use an INPUT element with TYPE=TEXT.
It is recommended in the specifications that browsers canonicalize line endings to CR, LF (ASCII decimal 13, 10) when submitting the contents of the field. However, authors should not rely on this, since not all browsers behave so. The character set for submitted data should be ISO Latin 1, unless the server has previously indicated that it can support alternative character sets.
The HTML specifications do not quite explicitly require that the contents of a TEXTAREA element (specifying the initial value) is to be rendered as it is written with respect to division into lines etc (similarly to PRE elements), but this is clearly the intention.
Typically browsers display the textarea content (both the initial content and the content entered by a user) in a fixed font. Although a TEXTAREA may occur within text level markup, it is thus usually not affected by it.
Browsers do not always honor the ROWS and COLS attributes exactly. Rather often the visible input area is somewhat larger than specified by them.
You cannot use ROWS and COLS attributes to restrict the size of the actual input, nor can you do that with other HTML constructs. The script that processes the form can be written so that it takes care of handling excessively large input if needed.