HTML <textarea> Tag

Description:

The HTML <textarea> tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows.

 

Specific Attributes:

Attribute Definition
name Assigns a name to the input control.
rows Specifies the height of the textarea based on the number of visible lines of text. If there's more text than this allows, users can scroll using the textarea's scrollbars.
cols Specifies the width of the textarea based on the number of visible character widths.

Other Attributes:

Attribute Definition
dir

Specifies the text direction for the content in an element.
Possible Values:

  • rtl  (Right to Left)
  • ltr  (Left to Right)
class Specifies a classname for an element.
id Specifies a unique id for an element.
lang Specifies a language code for the content in an element.
title Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip").
style Specifies an inline style for an element.
readonly Sets the textarea to read-only - it won't allow the user to change the value. The textarea however, can receive focus and is included when tabbing through the form controls.
disabled Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
tabindex Specifies the tab order of an element.

Example Code:

<textarea cols="40">
You can write whatever text you want in the textarea.
</textarea>

Result