My goal is to attach this navigation bar to the bottom of a header, but it's sticking to the top instead. I want the navigation to remain at the bottom of the header even when the user scrolls down.
Currently, both the header and navigation are set to position: fixed, so they hover over the content as intended. However, the navigation bar stays at the top of the header rather than the bottom, cutting off the first part of the content. Can anyone suggest a CSS-only solution to fix this issue with non-nested fixed elements? They seem to not stack as expected.
<div id="wrapper">
<header></header>
<nav>
<ul>
<li href="#">1</a></li>
<li href="#">2</a></li>
<li href="#">3</a></li>
</ul>
</nav>
<main>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
<p>aaaaaaaaaaaa</p>
</main>
</wrapper>
HTML
header{
position: fixed;
background-color: #333;
padding-left: .5rem;
width: 100%;
font-size: 1rem;
padding-bottom: 1rem;
padding-top: 1rem;
z-index: 100;
}
nav{
position: fixed;
bottom: 0;
display:block;
background-color: yellow;
width: 10rem;
}
CSS
To see the current behavior in action, check out this CodePen link: http://codepen.io/anon/pen/XKbVVX