I have a sidebar with a footer fixed on the bottom of the sidebar. I want to add a scrollable sidebar when it encounters short height.
My HTML:
<div>
<aside>
<header>
....
</header>
<ul>
<li> ... </li>
<li> ... </li>
</ul>
<footer>
<li> ... </li>
</footer>
</aside>
....
....
</div>
My CSS:
.aside {
background:yellow;
overflow-y:scroll;
min-height:100vh; // I also tried height: 100%;
}
.header {
overflow: hidden;
}
.ul {
...
}
.footer {
position:fixed;
bottom:0;
}
When I do height:100%
, it seems like aside is ignore the existence of the footer. On the other hand, when I set min-height:100vh
, my footer is fixed so it follows the browser's scrollbar for the entire div
.
What I am trying to achieve is that if the user adjust the height of the browser, I want the sidebar to be responsive and appear a scrollable sidebar. I prefer just using only CSS & HTML to achieve this behavior.