HTML Tag Reference - HTML tag <textarea>

This <textarea> element creates a multiline text entry control. This element is usually used in conjunction with the <form> element.

Browser compatibility

<textarea> Yes Yes Yes Yes Yes

What's new in HTML5

HTML5 added several new attributes.


Attribute Value Description
autofocus autofocus auto focus textarea
cols number Set the visible width of a textarea
disabled disabled Disable a textarea
form form_id Set one or more forms id
maxlength number Set the maximum number of characters allowed in the textarea
name text Set a name for a textarea
placeholder text Set hint text for textarea
readonly readonly Make textare read-only
required required Mark textarea as must-fill
rows number Set the visible number of lines in a text area
wrap hard
how to wrap the text in a textarea when submitted in a form

Global Attributes

The <textarea> tag supports the Global Attributes in HTML.

Event Attributes

The <textarea> tag supports the Event Attributes in HTML.

Default CSS Settings



          <fieldset align="center">
               <textarea name="textfield1" 
                         cols="40" wrap="hard">
                         your name and surname
</body><!--from  ww  w .  j a  v a  2  s  .c om-->

Click to view the demo

rows attribute

This attribute establishes the height of the element in terms of rows. The value is indicated by an integer.

     <form name="form1" method="post" action="">
     <!-- w  w w. j  a  v  a 2  s  .  c o  m-->
          <fieldset align="center">
               <textarea name="textfield1" 
                         wrap="hard">your name and surname</textarea>

Click to view the demo