I have experimented with various CSS guides in order to place the footer at the bottom of the page, and I have found the example below to be the simplest method.
html,
body,
#root {
height: 100%;
}
#root {
display: flex;
flex-direction: column;
}
nav {
position: sticky;
top: 0;
}
section {
flex: 1;
}
section>div {
height: 1000px;
}
<div id="root">
<header>Header</header>
<nav>Navigation</nav>
<section>
<div>Test</div>
<div>Test</div>
<div>Test</div>
</section>
<footer>Footer</footer>
</div>
This method successfully places the footer at the bottom of the page, but sometimes the navigation bar does not scroll properly.
The issue may be due to setting the height of the #root element to 100%.
While I can speculate on "why" this problem is occurring, I am unsure of "how" to resolve it while keeping the nav element at the top of the page.
Any assistance would be greatly appreciated.