Languages
[Edit]
EN

How to autogrow textarea with CSS3?

19 points
Created by:
user4838
668

It is not possible to enable autogrowing for textarea with CSS3 and earlier versions.

Hint: read this article how to do it with JavaScript.

 As alternative contenteditable attribute with div element can be used.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <style>

    .textarea {
      border: 1px solid silver;
      width: 300px;
      min-height: 20px;
      max-height: 200px;   /* optional */
      overflow-x: hidden;
      overflow-y: auto;
    }

  </style>
  <div class="textarea" contenteditable="true"></div>
</body>
</html>

See also

  1. JavaScript - how to make textarea autogrow? 
  2. HTML - change textarea size

  3. CSS - change textarea size

Alternative titles

  1. CSS3 - autogrow textarea
  2. CSS3 - auto grow textarea
  3. CSS3 - auto sizing textarea
  4. CSS3 - autosizing textarea
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.

CSS

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