HTML | <textarea> tag

In the <textarea> tag defines a multi-line text input control. A text space will hold an infinite range of characters, and therefore the text renders in a set-width font (usually Courier).
The size of a text area is often such by the cols and rows attributes, or perhaps better; through CSS’ height and dimension properties.

Syntax:

<textarea>....</textarea>

Attribute:

  • autofocus: It specifies when the page is loaded text area will automatically focus
  • cols: It specifies width of text area are visible
  • dirname: It specifies text area are disable
  • form: It specifies one or more forms the text area belongs to
  • maxlength: It specifies how many character are allowed in text area
  • name: It specifics name of an element
  • placeholder: The placeholder attribute specifies a short hint that describes the expected value of an input field/text area
  • readonly: it shows the text should be read-only
  • rows: It shows the visible number of line in a text area
  • wrap: It will Specifies how the text in a text area are wrapped at a given width when submitted in a form

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <title>textarea tag</title
    <style
        h1, 
        h2 { 
            color: green; 
            font-style: italic; 
        
          
        body { 
            text-align: center; 
        
    </style
</head
  
<body
    <h1>GeeksForGeeks</h1
    <h2>HTML Textarea tag </h2
    <form action="#"
        <textarea rows="7"
                cols="50"
                name="comment">
              
        </textarea
        <input type="submit"
    </form
</body
  
</html

chevron_right


Output:

Supported Browsers: The browsers supported by HTML <textarea> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.