Given a fixed-size flex container with 2 columns:
- A left dynamic content-based width column;
- A plain resizable (in both directions) textarea.
I want to control the textarea
width, when resized (in both directions) by a user.
How can I enforce container's max-width
size to the textarea
(without javascript and/or disabling horizontal resize) as if the textarea
was a direct child of the container?
The only working CSS-only solution that I've found is display: contents
on the .right-content
column which unfortunately is not supported by all browsers.
.container {
max-width: 100px;
background-color: red;
display: flex;
}
.left-content {
background-color: yellow;
}
.right-content {
display: contents;
}
<div class="container">
<div class="left-content">foo</div>
<div class="right-content">
<textarea>bar</textarea>
</div>
</div>