Specifies the width of the text area. Default value is 20.
Sample Coding for cols Attribute in HTML:
Tryit<!DOCTYPE html><html><body><head><title>Wikitechy HTML cols attribute</title></head><textarea rows="5" cols="80">
Wikitechy is an enhanced tutorials zone providing the best learning curve.
Sample code is provided for each and every topic to improve the user's knowledge.
</textarea></body></html>
Code Explanation for cols Attribute in HTML:
<textarea> tag used to define a multi-line text input control.
row attribute is used to set the number of lines as “5” in a text area.
cols attribute is used to set the width as “80” for the textarea.
Output fo cols Attribute in HTML:
In this output, the content Wikitechy is an enhanced tutorials... had been displayed with a specified width in a text area.
Browser Support for cols Attribute in HTML:
Yes
Yes
Yes
Yes
Yes
Tips and Notes
The textarea size can also be determined by the CSS height and width properties.