Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

<textarea>

<textarea
accesskey=key
align=absbottom|absmiddle|baseline|bottom|left|middle|right
|texttop|top

class=type
cols=n
dir=ltr|rtr
disabled
id=value
lang=language
name=name
readonly
rows=n
style=style
tabindex=integer
title=text
wrap=off|virtual|physical
</textarea>

Creates a multiline text entry control in which the user can type and edit text.

The end-tag is required.

Attributes

accesskey=key

Specifies a shortcut key for the link. You activate the link by pressing Alt and the access key together; like standard menu shortcuts in Windows applications.

align=absbottom|absmiddle|baseline|bottom|left|center
|right|top|middle|texttop

Sets the alignment of the text area. The default is top.

Value…

Description…

absbottom

Aligns with the bottom of the current line

absmiddle

Aligns the middle of the current line with the middle of the textarea

baseline

Aligns the bottom of the textarea with the baseline of the current line

bottom

Surrounding text is aligned with the bottom of the textarea

left

The textarea is drawn as a left-flush and text flows around it

center

Surrounding text is aligned with the centre of the textarea

right

The textarea is drawn as a right-flush and text flows around it

top

Surrounding text is aligned with the top of the textarea

middle

Surrounding text is aligned with the middle of the textarea

texttop

Aligns itself with the top of the tallest text in the line

class=type

Indicates the class to which the tag belongs. You can use the class attribute in a style sheet to create different styles that you want apply to a single HTML tag. For example, you might create three different styles for a <textarea> tag. See Using the class attribute as a selector for more details.

cols=n

Sets the width, in characters, of the text area.

dir=ltr|rtr

Specifies the direction of text. This can be left-to-right (ltr) or right-to-left (rtl). For example, English characters are presented left-to-right, Hebrew characters are presented right-to-left.

disabled

Setting the disabled flag for a <textarea> box disables it from receiving any user input, or focus. It can still display values, text etc., but the user will not be able to make any changes to those values.

id=value

Specifies a unique name for the tag. No two tags can have the same id on a single page. The value must begin with a letter followed by any alphanumeric character, a hyphen, an underscore, a colon or a full stop. You use it to reference a unique style for a tag or to manipulate the tag with a script.

lang=language

Specifies which language the <textarea> tag uses. You can enter any valid ISO standard language abbreviation, for example, “en” for English, “de” for German and so on. For example, <span lang="es">hola! como esta?</span>.

This attribute helps search engines understand different languages as different languages rather than just misspelled English. It may also help spelling and grammar checkers and allow speech synthesizers to use language-dependent pronunciation rules.

name=name

Sets the name of the text area. This name is used when the tag is used within a <FORM> tag.

readonly

The readonly flag is slightly different to the disabled flag in that an <textarea> element labelled as readonly can still receive the users focus, but the contents of the control can not be changed.

rows=n

Sets the height, in characters, of the text area.

style=style

Specifies style information. See Style sheets for more information.

tabindex=integer

Sets a tabbing order for the user to navigate around the main topic. For example, if <form> elements have tabindex properties set, when the user is focused on an element, pressing the 'Tab' key will pass the focus to the element with the next highest tabindex property.

title=text

For information only. Some browsers display the title when the mouse moves over the tag (like a tool tip).

wrap=off|virtual|physical

Specifies how to handle word wrap in the textarea.

Any text between the start-tag and end-tag is used as the initial value for the control.