HTML | <textarea> cols Attribute

The HTML <textarea> cols Attribute is used to tell the browser how many average-width characters should fit on a single line i.e the number of columns to display.
It is used to specify the visible width of the <Textarea> Element.

Syntax:

<textarea cols="number">

Attribute Values: It contains the value i.e number which specifies the width of the Textarea. It has a Default value which is 20.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- HTML program to illustrate cols attribute -->
  
<!DOCTYPE html>
<html>
  
<head>
    <title>
      HTML Textarea cols Attribute
  </title>
    <style>
        h1,
        h2 {
            text-align: center;
        }
    </style>
</head>
  
<body style="text-align:center;">
    <h1 style="color: green;"
            GeeksforGeeks 
        </h1>
  
    <h2
        HTML <textarea>cols Attribute 
      </h2>
  
    <!-- Below textarea is 
        assigned a cols value 25 
            That is, 25 characters
          will fit in a line -->
    <textarea rows="4" 
              cols="25">
        A computer science portal for geeks.
    </textarea>
</body>
  
</html>

chevron_right


Output :

Supported Browsers: The browser supported by HTML <Textarea> cols Attribute are listed below:

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


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.