My structure consists of a Header, Body, and Footer
<div id="my-element">
<div id="header">...</div>
<div id="body">
...
</div>
<div id="footer">...</div>
</div>
Currently, the element with the ID #my-element
is limited to the height of the browser window. The elements with IDs #header
and #footer
can have varying heights but should not be scrollable. Only the element with the ID #body
is allowed to be scrollable, which happens when the combined heights of all three elements exceed that of #my-element
. In such cases, only the #body
element will display a scrollbar.
I believe there may be a simple solution using flexbox, but since I am not familiar with that property, I have not been able to find one yet.