title: position fixed inside parent div
body: <p>i'm trying to set a div positiong fixed inside a parent div.
  When i set the fixed div to top 0, it is on the top of the body.</p>
  
  <p>The fixed div should be scroll with the page</p>
  
  <p>here is my code example:</p>
  
  <pre><code>    &lt;div class="container"&gt;
  
      &lt;div class="col-sm-8"&gt;
          &lt;p&gt;content&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div class="col-sm-4"&gt;                  
          &lt;div id="sidebar"&gt;
              &lt;div class="inner"&gt;
                  &lt;ul&gt;
                  &lt;li&gt;link&lt;/li&gt;
                  &lt;li&gt;link&lt;/li&gt;
                  &lt;li&gt;link&lt;/li&gt;
                  &lt;li&gt;link&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;                
      &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;style&gt;
  
  .container {
      width: 1170px;
      display: table;
  }
  
  .col-sm-8, col-sm-4 {
      position: relative;
      float: left;
  }
  
  .inner {
      position: fixed;
      top: 0;
  }
  
  &lt;/style&gt;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/lyLgk.jpg" rel="nofollow">example screen layout</a></p>