HTML Textarea HTML Textarea
HTML Textarea Tutorial and Information

HTML Tutorial - HTML Textarea

The <textarea> tag or element indicates a text area in an HTML form field and the textarea element is often used in combination with HTML forms. The content of a textarea is interpreted as text only.
HTML formatting is not considered inside a text area element.
A text area can contain an unlimited amount of characters. The text area or form field can be an empty field allowing the user to insert text, or text can be displayed in the form field inside the textarea element.

How To Create A Textarea Or Form Field

<textarea>This is a textarea.</textarea>

And this is what a textarea looks like in a browser window:

Text Area Attributes

The following attributes are mandatory in connection with the text area element if you want your HTML document to validate in a HTML or XHTML validator:
<name> - indicates the name of the text area or form field
<cols> - indicates the width of the text area by character
<rows> - indicates the height of the text area
<textarea name="textarea1" cols="50" rows="5">This is a textarea.</textarea>

And this is what this textarea looks like in a browser window. We have named this text area "textarea1", the width is set to "50" (50 characters wide) and the height is set to "5" (5 character rows):

Click inside the text area and you will be able to edit or add as much text as you like.

More Textarea Attributes

<readonly> - the user can not change the text in the textarea
<disabled> - the textarea is disabled
<onchange> - action to take when the text inside the textarea was modified
<textarea name="textarea1" readonly="readonly" cols="50" rows="5">This is a textarea 
with a readonly attribute.</textarea>

And this is what this textarea looks like in a browser window. Notice you are not able to modify the text or add text to the textarea:

How To Use A Textarea In Forms

The textarea tag is commonly used in connection with the form tag and/or the input tag. Here is an example of an email form using the textarea element:
<form action="../cgi-bin/" method="post">
Your Message:<br />
<textarea name="email" cols="50" rows="5"></textarea>
<br />
<input type="submit" value="submit">

And this is what the email form with a button using the textarea looks like:

Your Email Message:

HTML Related Links

© This Article is Copyrighted by

Please do not copy or reproduce this article in whole or part, in any form, without mentioning the source and including a live link back to - Thank You!


Copy the code below and paste into your web page
<a href="">
Webmaster Seminar</a><br />
HTML Textarea - Free Information, Tutorials and HTML Resources