html tutorial - cols Attribute in HTML - html5 - html code - html form



Cols attribute in html

Learn html - html tutorial - Cols attribute in html - html examples - html programs

  • The cols attribute defines the visible width of a text area.
  • The cols attribute specifies a column within a textarea.

Syntax for cols attribute in HTML:

<textarea cols = “number”>content </textarea>

Applies To:

Elements Attribute
<textarea> cols

Attribute Values:

Value Description
number 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:

 cols Attribute Code Explanation

  1. <textarea> tag used to define a multi-line text input control.
  2. row attribute is used to set the number of lines as “5” in a text area.
  3. cols attribute is used to set the width as “80” for the textarea.

Output fo cols Attribute in HTML:

 cols Attribute Tag Output

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

Related Searches to cols Attribute in html