<textarea> Tag in HTML | Multiline Input Field

The <textarea> tag in HTML is used to create a multi-line text input field, allowing users to input large amounts of text. Unlike the <input type="text"> field, <textarea> can span multiple lines, making it ideal for comments, feedback, or any extended text content.

Key Points on <textarea> Tag:

Syntax of <textarea> Tag:

Syntax Example

<textarea name="field_name" rows="5" cols="40">Default text</textarea>

Example of <textarea> Tag in HTML:

This example demonstrates the use of the <textarea> tag with placeholder text and custom rows and columns.

Code Example

<form action="/submit_comment" method="post">
            <label for="comment">Enter your comment:</label>
            <textarea id="comment" name="comment" rows="4" cols="50" placeholder="Write your comment here..."></textarea>
        </form>

Output


Attributes of <textarea> Tag:

Advantages of Using <textarea> Tag:

The <textarea> tag is essential for creating multi-line input fields in HTML forms, making it a versatile and interactive element for users to submit long-form text content.