Languages
[Edit]
EN

How to autogrow textarea with CSS3?

13 points
Created by:
Kate_C
19800

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>
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join