How to Create a Multi-line Text Input (Text Area) In HTML? (2024)

To create a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.

Here are the attributes of <textarea> tag −

AttributeValueDescription
autofocusHow to Create a Multi-line Text Input (Text Area) In HTML? (1)autofocusSpecifies that on page load the text area should automatically get focus.
ColsnumberSpecifies the width of the textarea based on the number of visible character widths.
DisableddisabledSpecifies the width of the textarea based on the number of visible character widths.
formHow to Create a Multi-line Text Input (Text Area) In HTML? (2)form_idSpecifies one or more forms.
maxlengthHow to Create a Multi-line Text Input (Text Area) In HTML? (3)numberSpecifies the maximum number of characters in textarea.
NametextAssigns a name to the input control.
placeholderHow to Create a Multi-line Text Input (Text Area) In HTML? (4)textSpecifies a short hint of the value in textarea.
ReadonlyreadonlySets the input control to read-only. It won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls.
requiredHow to Create a Multi-line Text Input (Text Area) In HTML? (5)requiredSpecifies that a textarea is required.
RowsnumberSpecifies the height of the textarea based on the number of visible lines of text. If there's more text than this allows, users can scroll using the textarea's scrollbars.
wrapHow to Create a Multi-line Text Input (Text Area) In HTML? (6)hardsoftSpecifies the text to be wrapped in textarea.

How to Create a Multi-line Text Input (Text Area) In HTML? (7)

Example

You can try to run the following code to create a multi-line text input in HTML −

<!DOCTYPE html><html> <head> <title>HTML textarea Tag</title> </head> <body> <form action = "/cgi-bin/hello_get.cgi" method = "get"> What improvements you want in College? <br> <textarea rows = "5" cols = "60" name = "description"> Enter details here... </textarea><br> <input type = "submit" value = "submit" /> </form> </body></html>

How to Create a Multi-line Text Input (Text Area) In HTML? (8)

Samual Sam

Learning faster. Every day.

Updated on: 02-Sep-2023

43K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started

How to Create a Multi-line Text Input (Text Area) In HTML? (9)

Advertisem*nts

How to Create a Multi-line Text Input (Text Area) In HTML? (2024)
Top Articles
Latest Posts
Article information

Author: Errol Quitzon

Last Updated:

Views: 6652

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Errol Quitzon

Birthday: 1993-04-02

Address: 70604 Haley Lane, Port Weldonside, TN 99233-0942

Phone: +9665282866296

Job: Product Retail Agent

Hobby: Computer programming, Horseback riding, Hooping, Dance, Ice skating, Backpacking, Rafting

Introduction: My name is Errol Quitzon, I am a fair, cute, fancy, clean, attractive, sparkling, kind person who loves writing and wants to share my knowledge and understanding with you.