Consider the following page, which displays a line of text with a <textarea>
underneath it.
* {
box-sizing: border-box;
}
html, body {
height: 100%;
margin: 0;
}
.outer {
background-color: #eee;
display: flex;
flex-direction: column;
height: 100%;
padding: 10px;
}
.expand {
flex-grow: 1;
}
textarea {
height: 100%;
width: 100%;
}
<div class="outer">
<p>
Nice little wall of text.
</p>
<div class="expand">
<textarea></textarea>
</div>
</div>
The intended behavior is to have the textarea occupy the remaining height of the page underneath the line of text. Using flexbox, I can make the .expand
element occupy the remaining height of the page. However, despite having height: 100%;
set on the textarea it refuses to occupy the full height of its parent.
Why isn't this working and how can I make the textarea fill its parent?
flex-grow: 1
on the parent? – Immenseflex-grow: 1;
set on the parent. – Bedlam