HTML cols attribute

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

Example

<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>
Try </>

cols attribute values

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.

Example

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

Try </>

Related Tags

The tags that support this attribute are as follows.

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

Example

<textarea style="width:500px; resize:none;">
CSS properties may also be used to define the width of textarea instead of cols. The size of this textarea can not be changed.
</textarea>

Try </>

Related Pages

For the height (vertical dimension) of the textarea, the rows attribute is used.

You can also visit textarea tag.



Was this article helpful?

 

Email:

Message:

Get the newsletter