<main class="container">
  <nav class="nav">
    <ul>
      <li>Home</li>
      <li>About</li>
      <li>Contact</li> 
    </ul>
  </nav>
  <div class="main-content">Main Content</div>
  <footer class="footer">Footer</footer>
</main>
body
  color #fff
  font-family sans-serif
  font-size 20px

.container
  max-width 600px
  margin 0 auto
  border solid 1px #bbb
  padding 15px
  margin-top 40px
  background #eee
  
.main-content
  padding 10px
  background #bbb
  min-height 1000px
  margin-top 15px

.nav
  padding 5px 
  background #222
  position -webkit-sticky
  position sticky
  top 0
  
  ul
    display flex
    list-style none
    justify-content space-around  
    
.footer
  padding 5px 
  background #bbb
  margin-top 15px
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.