Advertisement
Home Open Editor ❯

HTML cols Attribute

Example

<form action="action.php">
  <label for="demo">textarea demo:</label>
  <textarea cols="25" id="demo" name="textareaText">
  Hello world!
  </textarea>
  <br><br>
  <input type="submit" value="Submit">
</form>

Try this code ❯

Meaning

The cols attribute specifies the width, in characters, of the text area.

The typical default value for the size of a <textarea> tag when this attribute is not set is 20 characters.


Standard Syntax

<element cols="number">


Applies to:

The cols attribute can be used on the following element:

Element Attribute
<textarea> cols

Advertisement

Attribute Values

Value Description
number (non-negative integer) Specifies the expected maximum number of characters per line. by default, it is 20.
Home Open Editor ❯
Advertisement