HTML <textarea> cols Attribute

The cols attribute on a textarea tag sets the width of the textarea in number of characters. Effectively, it defines how many characters are visible on each line.

Example

#

A cols attribute on a textarea element.
The cols attribute dictates the width of the textarea.

<textarea rows="5" cols="60">
Unlike most Dutch masters of the 17th century,
Rembrandt's works depict a wide range of style
and subject matter, from portraits and self-portraits
to landscapes, genre scenes, allegorical and
historical scenes, and biblical and mythological
themes as well as animal studies.
</textarea>

Using cols

The cols attribute specifies the width of the textarea.

The width is specified as the number of cols (columns), i.e. characters, on each row.

If not set, the default value for a textarea is 20 characters.

Tip: The width and height of a textarea can also be specified by CSS.


Syntax

<textarea cols="number">

Values

#

Value Description
number A number, e.g. 55.

Browser support

Here is when cols support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <textarea>
Guides