HTML Textareas
The <textarea> tag is an HTML element that represents a multiline text field in a form. It is usually used for comments, messages, description, or feedback fields.
<textarea> tag is not self-closing and has an opening and closing tag.

Syntax
<textarea name="message" rows="4" cols="50"></textarea>
Example
<form> <label for="comments">Your Comments:</label><br> <textarea id="comments" name="comments" rows="5" cols="40"></textarea> </form>
Attributes for Textarea
| Attribute | Description |
|---|---|
| name | The name of the textarea (used in form submission) |
| rows | Number of visible text lines |
| cols | Width of the textarea in character columns |
| placeholder | Hint text displayed inside the box |
| maxlength | Maximum number of characters allowed |
| required | Makes the field mandatory before form submission |
| readonly | Makes the field uneditable |
| disabled | Disables the field, making it unselectable |
| wrap | Controls how text wraps inside the box (soft, hard) |

- Always label your <textarea> tag with a <label> tag.
- Use the placeholder attribute for hints, not for instructions.
- Use maxlength attribute to limit the user input.
- Style with CSS for a better UI/UX.
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com