<textarea> tag

HTML <textarea> tag

The <textarea> tag represents a multi-line plain-text editing control.

You can control the size the textarea using rows, cols or CSS size properties.

Syntax:
<textarea rows=”number-of-rows” cols=”number-of-columns”>Type text here</textarea>

Example

<textarea rows="7" cols="50">Text here</textarea>

How Browser will display

BLOCK Level.

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
No Difference No Difference There are New attributes are added for this tag in HTML5.

Attributes used with <textarea> tag

Attribute Description
autocomplete To enable if autocomplete is on or off.
autofocus To focus on the element when the page loads.
cols The width of a text area which is visible.
dirname Defines the direction of the text.
disabled To disable an element
enterkeyhint To enter te hint for the key
form Forms that relates to the textarea .
maxlength The maximum number of text that the textarea can contain.
minlength The minimum number of text that the textarea can contain.
name The name of the element.
placeholder A hint which is displayed for a field to define what is to be shown in textarea.
readonly To inform that the textarea is readoly.
required To make an element mandatory and thee user has to fill it in the form.
rows The rows which are visible in the textarea.
wrap Informs that the text should be wrapped after the while submitting the form.

Note/Info:
It is better to remove the grabber at the bottom right corner. To do this, just code resize:none.

Global Attributes

The <textarea> tag supports Global attributes.

Event Attributes

The <textarea> tag supports Event attributes.

Supporting Browsers

supporting-browsers for tags

Related Tags

<input>, <label>, <form>, <legend>, <fieldset>, <optgroup>, <button>, <select> & <option> tags.

Tutorials for all brains!