Развернуть текстовое поле, чтобы оно соответствовало его содержимому с помощью CSS? ⇐ CSS

Разбираемся в CSS
Гость
Развернуть текстовое поле, чтобы оно соответствовало его содержимому с помощью CSS?

Сообщение Гость »


I'm trying to get a content editable text box ( element) to grow as needed to fit the text typed into it, up to 80% of the width of the parent div.

Is there any way to do this with just CSS? If not, I'm open to Javascript solutions, but I am using React, which complicates things in that regard



This is NOT a duplicate of any other question I'm aware of, as it requires a solution which is:
  • Independent of viewport size
  • Supports a parent div with a

    Код: Выделить всё

    max-width
  • Works on contentEditable
  • Works when the text content changes


Источник: https://stackoverflow.com/questions/435 ... t-with-css

Вернуться в «CSS»