title: Scroll part of content in fixed position container
body: <p>I have a <code>position: fixed</code> div in a layout, as a sidebar. I've been asked to have part of it's content stay fixed to the top of it (internally), and the rest to scroll <em>if it overflows the bottom of the div</em>.</p>
  
  <p>I've had a look at <a href="https://stackoverflow.com/a/4646733/383609">this answer</a>, however the solution presented there doesn't work with <code>position: fixed</code> or <code>position: absolute</code> containers, which is a pain.</p>
  
  <p>I've made a JSFiddle demonstration of my problem <a href="http://jsfiddle.net/jamwaffles/AKL35/1" rel="noreferrer">here</a>. The large amount of text should ideally scroll, instead of overflowing into the bottom of the page. The height of the header can vary with content, and may be animated.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
      background: #eee;
      font-family: sans-serif;
  }
  
  div.sidebar {
      padding: 10px;
      border: 1px solid #ccc;
      background: #fff;
      position: fixed;
      top: 10px;
      left: 10px;
      bottom: 10px;
      width: 280px;
  }
  div#fixed {
      background: #76a7dc;
      padding-bottom: 10px;
      color: #fff;
  }
  
  div#scrollable {
      overlow-y: scroll;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="sidebar"&gt;
      &lt;div id="fixed"&gt;
          Fixed content here, can be of varying height using jQuery $.animate()        
      &lt;/div&gt;
  
      &lt;div id="scrollable"&gt;
          Scrolling content&lt;br&gt;&lt;br&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.
          
          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.
          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.
          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;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Without a fixed header, I can simply add <code>overflow-y: scroll</code> to <code>div.sidebar</code> and I can happily scroll all it's content if it overflows the bottom of the container. However, I'm running into issues with having a fixed, variable height header at the top of the sidebar, and having any content underneath that scroll if it's too long to fit into the container. </p>
  
  <p><code>div.sidebar</code> <em>must</em> stay <code>position: fixed</code>, and I would very much like to do this without any hacks, as well as make it as cross browser as possible. I've attempted various things, but none of them work, and I'm unsure as to what to try from here.</p>
  
  <p>How can I make a div inside a <code>position: fixed</code> container scroll only in the Y direction when it's content overflows the containing div, with a fixed header of varying, indeterminate height? I'd very much like to stay away from JS, but if I have to use it I will.</p>