I am trying to make a simple HTML/CSS based chat UI, where there are three vertical divs: Header, Chats, and Send Bar.
If I have three div
s, how can I the middle div be the full "middle" height, and still be scrollable for scrolling messages? I can do this if I set the send bar div to a static height, but if I want it to be growable, that approach doesn't work.
Does anyone know how to use css to make a responsive chat-like UI such that the middle content is scrollable and the send bar content is growable?
I don't think it matters, but this is a React app.
Here is a code example of the issues I am seeing: (a) the lower div isn't sticky to the view, and (b), the middle div isn't scrollable.
See fiddle and snippet:
.wrapper {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: flex;
flex-direction: column;
}
.top {
height: 10px;
background: yellow;
}
.bottom {
background: gray;
}
.middle {
background: red;
width: 100%;
height: 100%;
}
<div class="wrapper">
<div class="top">
</div>
<div class="middle">
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
<p>
Test
</p>
</div>
<div class="bottom">
<p>
some content
</p>
</div>
</div>