I have this basic layout with a static header and footer, pushed to the top and bottom respectively. The content section in the middle fills the space, and there’s a scrollbar for this section in case the content is too large for it to fit.
<div id="app">
<div id="header">
Header
</div>
<div id="middle">
Middle content
</div>
<div id="footer">
Footer
</div>
</div>
html,
body {
height: 100%;
overflow: hidden;
margin: 0;
}
#app {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
#header {
height: 60px;
background-color: blue;
}
#footer {
height: 60px;
background-color: red;
}
#middle {
flex: 1;
overflow-y: scroll;
align-items: flex-end;
}
I want the content of this middle section to start from the bottom, and not the top, while keeping the overflow scrollbars in case the content is too big, but I can’t seem to figure out how.
I’ve tried setting margins to 0 and read about flex-direction, but none of those seem to work.
2
Answers
You can try the following :
Please add this in your css:
Please update your css there are not major changes. Use proper
HTML
tags in#middle
With this approach the first child in
#middle
will start from the bottom and rest will follow it. you can play around with thispadding-top
.