HTML cols Attribute


The cols attribute in HTML is used specifically within the <textarea> element to define the visible width of the text area. This attribute specifies the number of characters that can be displayed in one row of the text area. The value of the cols attribute is a positive integer reflecting the desired width. It directly influences the layout of the form element on the web page, helping to control how content is presented and interacted with by users. For example, setting cols="50" would aim to display a text area that can accommodate approximately 50 characters per line. This attribute does not affect the actual character capacity of the <textarea>, which can hold and transmit much more data than is visibly displayed. Instead, it is used primarily for visual formatting, enhancing user experience by ensuring the text area's size is appropriate for its intended use. Note that CSS can also be used to control the dimensions of a <textarea>, offering a more flexible and powerful way to style web forms in modern web development practices.


<textarea cols="number">


  • numberA number that specifies the width of a textarea of visible characters.

Applies To

The cols attribute can be used on the following html elements.


<textarea cols="60" rows="10">This is a textarea element with a width of 60 characters.</textarea>

Browser Support

The following table will show you the current browser support for the HTML cols Attribute.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 28th March 2024