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.
A cols
attribute on a textarea
element.
The cols
attribute dictates the width of the textarea.
<textarea rows="5" cols="50">
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>
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.
<textarea cols="number">
Value | Description |
---|---|
number | A number, e.g. 55. |
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 |
Back to <textarea>