HTML cols attribute

HTML cols attribute represents the number of characters per line in a textarea. This attribute visually represents the width of textarea.

<textarea cols="70">
 It represent maximum number of characters per line. This textarea has width due to cols. And 'cols' does not represent height. 
 </textarea>
</>

Attribute values

All possible values of cols attribute

The value of this attribute is a valid positive integer.

If cols attribute is omitted then textarea has 20 characters per line i.e. the value of cols attribute is 20.

<textarea>
It represent maximum number of characters per line. Here cols attribute is omitted. 
</textarea>
Try </>

Related Tags

The tags that support cols attribute

<textarea> tag

textarea tag represents an editable and resizable area of text. width attribute also decides the horizontal dimension of the textarea.

The size of the textarea can be fixed by 'resize' property.

<textarea style="width:500px; resize:none;">
 The size of this textarea can not be changed.
</textarea>

Try </>


Was this article helpful?