Open In App

How to create a multiline input control text area in HTML5 ?

Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <textarea> tag is used to specify a multiline input control text area in HTML5.  The <cols> and <rows> attributes specify size of a textarea.

Syntax

<textarea rows="" cols=""> Contents... </textarea>

The <textarea> tag contains 5 attributes that are listed below:

  • cols: It specifies width of textarea.
  • rows: It specifies height of textarea.
  • name: It holds the name to input control.
  • maxlength or minlength: It specifies the maximum or minimum number of characters in textarea.
  • placeholder: It specifies the hint of the value of textarea.

Example 1:

In this example, we will set the rows, and cols attribute to create a multiline control input textarea.

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <textarea rows="10" cols="20">
        welcome to GeeksforGeeks Aman Rathod.
        A perfect Portal for Geeks
    </textarea>
</body>
 
</html>


Output:

Example 2: In this example, we will set the number of characters allowed in the input textarea.

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h1 style="color:green;">
      GeeksforGeeks
    </h1>
    <textarea minlenght="100" maxlength="300"
        placeholder="Give Feedback here">
    </textarea>
</body>
 
</html>


Output: 

 



Last Updated : 06 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads