I am currently working on a design where I have a container with a specified maximum height. Inside this container, there are two separate divs. One of these divs (the footer) has a fixed height of 55px, while the other is a scrollable div that adjusts its height based on its content.
<div class="parent">
<div class="wrapper">
<div class="panel">
Scrollable Div
</div>
<div class="fixed">
Fixed footer
</div>
</div>
</div>
The height of the scrollable div should always match its content. However, if it exceeds the maximum height set for the wrapper (
.wrapper has a max-height of 300px
), it should only occupy the remaining space below the fixed footer without affecting its position.
Unfortunately, my current layout does not meet these requirements as expected.
In my implementation, when new content is added to the scrollable div, the footer protrudes outside the wrapper. Ideally, the footer should stay at the bottom of the wrapper without being cut off, and the scrollable div should expand upwards.
It's important to note that I want to avoid using position: fixed or absolute in this scenario.
Given that this is intended for a mobile application, fixed positioning often causes several issues.
You can view my progress so far in this JS Fiddle: fiddle