Skip to content
Related Articles

Related Articles

Improve Article
HTML | <textarea> tag
  • Last Updated : 17 Sep, 2019

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:




<!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

Output:

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

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



My Personal Notes arrow_drop_up
Recommended Articles
Page :