html - css how to prevent content from drifting underneath fixed position areas? -


i've created html template have sidebar set position: fixed; when minimize browser less width page set to, main content drifts underneath sidebar when user viewing sidescrolls.

is there fix set entire container sidebar , main content single fixed block?

http://jsfiddle.net/vuj6t/2/

<body> <div id="container">  <section id="sidebar"> <nav> <ul> <li><a href="/"></a></li> <li><a href="/"></a></li> <li><a href="/"></a></li> </ul> </nav> </section>  <section id="stream">  <article> </article>  <article> </article>  <article> </article>  </section>  </div> </body>   body {   height: 100%;   overflow: auto;   margin: 0;   padding: 0;   position: relative; }  #container {   margin: 0 auto;   padding: 0;   position: relative;   width: 700px; }  #sidebar {   display: block;   float: left;   overflow: hidden;   position: fixed;   width: 200px; }  #stream {   float: right;   margin: 0 0 0 210px;   padding: 0;   width: 490px; } 

you absolutely position sidebar on narrow screens using simple media query like

@media (max-width: 690px) {   #sidebar { position:absolute; } } 

http://jsfiddle.net/vuj6t/3/


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -