title: Bootstrap sidebar menu overlapped during content scroll
body: <p>I'm building a sidebar menu and have screwed something up. When the content is longer than the viewport, and the user scrolls down, the sidebar is covered up by the content.</p>
  
  <p>The sidebar should always stay at 100% height, with the <code>.box</code> div fixed at the bottom.</p>
  
  <p>I've tried adjusting the position to <code>absolute</code> and <code>fixed</code>, and adjusting the main content area <code>overflow</code> to <code>scroll</code> and a whole bunch of other things and just can't get it to work.</p>
  
  <p>What did I do wrong?</p>
  
  <hr>
  
  <h2>Here's a Fiddle</h2>
  
  <p><a href="https://jsfiddle.net/timgavin/s3vga1mm/" rel="nofollow noreferrer">https://jsfiddle.net/timgavin/s3vga1mm/</a></p>
  
  <hr>
  
  <h2>The CSS</h2>
  
  <pre><code>body {
      font-family: 'Open Sans', sans-serif;
  }
  
  #topbar {
      height: 60px;
      background: #F3F3F3;
  }
  
  /* sidebar is expanded by default */
  #sidebar-wrapper {
      position: absolute;
      z-index: 1;
      width: 250px;
      min-height: 100%;
      overflow-y: hidden;
      overflow-x: visible;
      background-color: #0F2849;
      transition:.5s;
  }
  
  /* hamburger icon */
  #sidebar-toggle {
      float: left;
      padding: 18px 20px 0 20px;
  }
  
  /* main content wrapper */
  #content-wrapper {
      position: absolute;
      width: 100%;
      padding-left: 250px;
      transition:.5s;
      font-size: 1.1em;
  }
  
  /* change the sidebar's width to zero to collapse the sidebar */
  #wrapper.sidebar-hidden #sidebar-wrapper {
      width: 0;
  }
  
  /* remove padding from main content so it collapses left with the sidebar */
  #wrapper.sidebar-hidden #content-wrapper {
      padding-left: 0;
  }
  
  /* add some padding to the top of the main content area without altering bootstrap classes */
  #container-fluid {
      padding-top: 20px;
  }
  
  /* TOP MENU CLASSES */
  .logo {
      width: 250px;
      background-color: #0F2849;
      height: 60px;
      padding-top: 5px;
      overflow: hidden;
      float: left;
  }
  
  .logo img {
      height: 45px;
  }
  
  .top-menu a {
      color: #222;
  }
  
  .top-menu a:hover {
      color: #82C2FA;
      text-decoration: none;
  }
  
  .top-links {
      float: left;
      list-style: none;
      padding: 2px 0 0 0;
  }
  
  .top-links li {
      float: left;
      padding: 20px 10px;
  }
  
  /* SIDE MENU */
  
  .sidebar-nav {
      padding: 20px 0 0 0;
      list-style: none;
      font-size: 1.1em;
  }
  
  .sidebar-nav li {
      text-indent: 10px;
      line-height: 44px;
      width: 250px;
  }
  
  /* icon padding */
  .sidebar-nav li i {
      padding-right: 7px;
  }
  
  .sidebar-nav li a {
      display: block;
      text-decoration: none;
      color: #ddd;
  }
  
  .sidebar-nav li a:hover {
      background-color: #0F2849;
      color: #fff;
      text-display: bold;
  }
  
  /* sub-menu links */
  .sidebar-nav .panel-body a {
      color: #87B2ED;
      font-size: 0.9em;
  }
  
  .sidebar-nav .caret {
      float: right;
      margin: 22px 15px 0;
  }
  
  #sidebar-wrapper .box {
      position: fixed;    /* remove this style if you want the box to float directly below the menu */
      bottom: 0;          /* remove this style if you want the box to float directly below the menu */
      border: 1px solid #3E526D;
      border-radius: 5px;
      margin: 40px 10px 10px 10px;
      width: 230px;
      padding: 10px
  }
  
  #sidebar-wrapper .box h4 {
      color: #B8C0C9;
      font-size: 1.1em;
      margin: 0 0 20px 0;
  }
  
  #sidebar-wrapper .box h5 {
      color: #87B2ED;
  }
  
  /* SUB MENU */
  
  /* remove bootstrap's default panel styling */
  .sidebar-nav .panel {
      background: transparent;
      border: 0;
      padding: 0;
      margin: 0;
  
  }
  
  .sidebar-nav .panel-body {
      padding: 0;
      background: #0F2849;
  }
  
  .sidebar-nav .panel-body ul {
      list-style: none;
      padding: 0;
  }
  
  .sidebar-nav .panel-body ul &gt; li {
      text-indent: 48px;
  }
  
  /* RESPONSIVE CLASSES */
  
  /* mobile &amp; tablet */
  @media only screen and (max-width : 992px) {
      /* sidebar is hidden by default */
      #sidebar-wrapper {
          width: 0;
      }
  
      /* content is flush-left by default */
      #content-wrapper {
          padding-left: 0;
      }
  
      /* change the sidebar's width to 250px to expand the sidebar */
      #wrapper.sidebar-hidden #sidebar-wrapper {
          width: 250px;
      }
  
      /* add padding to main content so it expands left with the sidebar */
      #wrapper.sidebar-hidden #content-wrapper {
          padding-left: 250px;
      }
  
      .logo {
          width: 80px;
          padding: 15px 7px 0 0;
      }
  
      .logo img {
          height: auto;
      }
  }
  </code></pre>
  
  <h2>The HTML</h2>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"&gt;
          &lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"&gt;
          &lt;link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"&gt;
          &lt;link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"&gt;
          &lt;link href="assets/css/app.css" rel="stylesheet"&gt;
          &lt;!--[if lt IE 9]&gt;
              &lt;script src="https://oss.maxcdn.com/libs/html5shiv/r29/html5.min.js"&gt;&lt;/script&gt;
              &lt;script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"&gt;&lt;/script&gt;
          &lt;![endif]--&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;div id="wrapper"&gt;
  
              &lt;!-- top links, logo, hamburger icon, etc. --&gt;
              &lt;div id="topbar"&gt;
  
                  &lt;div class="logo"&gt;
                      &lt;!-- remove &lt;a&gt; if desired, it has no affect on layout --&gt;
                      &lt;a href="/"&gt;
                          &lt;!-- logo for desktop --&gt;
                          &lt;img src="assets/img/logo.png" class="hidden-xs hidden-sm hidden-md img-responsive center-block" alt="Company logo"&gt;
  
                          &lt;!-- logo for mobile and tablet --&gt;
                          &lt;img src="assets/img/logo-sm.png" class="visible-xs visible-sm visible-md img-responsive center-block" alt="Company logo"&gt;
                      &lt;/a&gt;
                  &lt;/div&gt;
  
                  &lt;div class="top-menu"&gt;
                      &lt;!-- hamburger icon --&gt;
                      &lt;a href="#" id="sidebar-toggle"&gt;
                          &lt;i class="fa fa-bars fa-fw fa-2x"&gt;&lt;/i&gt;
                      &lt;/a&gt;
                      &lt;!-- top navigation links --&gt;
                      &lt;ul class="top-links"&gt;
                          &lt;li&gt;
                              &lt;a href="#"&gt;
                                  Link 1
                              &lt;/a&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                              &lt;a href="#"&gt;
                                  Link 2
                              &lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;!-- sidebar --&gt;
              &lt;div id="sidebar-wrapper"&gt;
                  &lt;ul class="sidebar-nav"&gt;
  
                      &lt;!-- start collapsable menu item with sub-menu --&gt;
                      &lt;!--
                          duplicate as often as needed, just make sure to give
                          each instance a unique ID (#id-goes-here)
                      --&gt;
                      &lt;li class="panel panel-default"&gt;
                          &lt;a href="#id-goes-here" data-toggle="collapse"&gt;
                              &lt;i class="fa fa-ticket"&gt;&lt;/i&gt;
                              &lt;span&gt;
                                  Tickets
                              &lt;/span&gt;
                              &lt;span class="caret"&gt;&lt;/span&gt;
                          &lt;/a&gt;
                          &lt;div id="id-goes-here" class="panel-collapse collapse"&gt;
                              &lt;div class="panel-body"&gt;
                                  &lt;ul&gt;
                                      &lt;li&gt;
                                          &lt;a href="#"&gt;
                                              &lt;span&gt;
                                                  Link 1
                                              &lt;/span&gt;
                                          &lt;/a&gt;
                                      &lt;/li&gt;
                                      &lt;li&gt;
                                          &lt;a href="#"&gt;
                                              &lt;span&gt;
                                                  Link 2
                                              &lt;/span&gt;
                                          &lt;/a&gt;
                                      &lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/li&gt;
                      &lt;!-- end collapsable menu item with sub-menu --&gt;
  
                      &lt;!-- regular menu items without sub-menu --&gt;
                      &lt;li&gt;
                          &lt;a href=""&gt;
                              &lt;i class="fa fa-pie-chart"&gt;&lt;/i&gt;
                              &lt;span&gt;
                                  Reports
                              &lt;/span&gt;
                          &lt;/a&gt;
                      &lt;/li&gt;
                      &lt;li&gt;
                          &lt;a href=""&gt;
                              &lt;i class="fa fa-sign-out"&gt;&lt;/i&gt;
                              &lt;span&gt;
                                  Log Out
                              &lt;/span&gt;
                          &lt;/a&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
                  &lt;div class="box"&gt;
                      &lt;h4&gt;Support&lt;/h4&gt;
                      &lt;!--
                      // uncomment if you want titles
                      &lt;h5&gt;Email&lt;/h5&gt;
                      --&gt;
                      &lt;p class="small"&gt;
                          &lt;a href="mailto:email@email.com"&gt;
                              email@email.com
                          &lt;/a&gt;
                      &lt;/p&gt;
                      &lt;!-- &lt;h5&gt;Call&lt;/h5&gt; --&gt;
                      &lt;p class="small"&gt;
                          &lt;a href="tel:877-379-8279"&gt;
                              123-456-7890
                          &lt;/a&gt;
                      &lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;!-- main content --&gt;
              &lt;div id="content-wrapper"&gt;
                  &lt;!-- .container-fluid to take up full width --&gt;
                  &lt;div class="container-fluid" id="container-fluid"&gt;
                      &lt;!-- add main content here --&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="col-xs-12"&gt;
                              &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;!-- stop main content here --&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;script src="https://code.jquery.com/jquery.js"&gt;&lt;/script&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
          &lt;script src="assets/js/app.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>