Languages
[Edit]
EN

HTML - change textarea size

0 points
Created by:
user4838
698

In this article, we would like to show you how to change textarea size in HTML.

Quick solution:

or:

Note:

It is recommended to use style attribute or CSS to change the textarea size.

 

1. Using style attribute

Edit

In this example, we use textarea element's style attribute to set its width and hight.

2. Using cols and rows

Edit

In this example, we use cols and rows attributes to set the textarea element width and height.

  1. cols - the number of visible characters width of the textarea - it is average characters width (if not specified, the default value is 20),
  2. rows - the number of visible text lines.

Runnable example:

3. Using CSS

Edit

You can also change the textarea element size using CSS.

The solution is described in details in the following article: 

See also

Edit
  1. How to autogrow textarea with CSS3?

  2. JavaScript - how to make textarea autogrow?

References

Edit
  1. <textarea> - HTML | MDN
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join