I'm trying to get a content editable text box (div
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