Login | Contact Us | Site Map | Resources

HTML Forms

Home > HTML Tutorial > HTML Textareas

HTML Textareas

Textareas are similar to text form fields, but span several lines instead of just one, and allow paragraphs to be defined.

Textareas are a complete element with an opening tag and a closing tag. If you want text to appear in the textarea by default, that text should be placed between the opening and closing tags.

<form action="what-to-do-next.php" method="post">
  <textarea>When is a car not a car? When it turns into a garage!</textarea>

The results of these two textareas are:

Our examples did not include the name attribute. If you plan to collect data from a textarea after a form is submitted, a unique name is necessary.

Two attributes unique to textareas are "rows" and "cols", both of which accept numeric values indicating the size of the textarea. An example is:

<form action="what-to-do-next.php" method="post">
  <textarea name="user-comment" rows="7" cols="70"></textarea>

The result is: