Reputation: 209
How can I make a div grow in height when a text-area is resized in html?
I have the following code
<div class="reply">
<p>Please enter your reply:</p>
<textarea rows="4" cols="80"></textarea>
<br />
<input type="submit" value="Submit reply"/>
<div class="clear"></div>
</div>
However when the user resizes, the text-area goes out of its container, how can I make the height of the parent div grow with the size of the text area?
Picture of problem
Upvotes: 10
Views: 12879
Reputation: 5734
Your .reply div
will be resized automatically if you do not give fixed height.
if you want to resize only vertically than try using -
textarea {
resize: vertical;
overflow: auto;
}
Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/resize
Upvotes: 15