The Wayback Machine - https://web.archive.org/web/20240118182939/https://www.geeksforgeeks.org/html-textarea-cols-attribute/
Open In App
Related Articles

HTML | <textarea> cols Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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: 

html




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


Output:

  

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

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 6
  • Firefox 1
  • Opera 12.1
  • Safari 4
Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 22 Jul, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials