html - static top navigation with the content hiding behind it on scroll -


here fiddle trying accomplish: http://jsfiddle.net/60h84j7u/

i want copy hide below top-nav div. can accomplish if background set other transparent in case, background top-nav needs transparent.

html

<div class="wrapper">     <div class="top-nav">this needs @ top</div>      <div class="copy"><p>this needs hide below top-nav user scrolls thru page.</p></div> </div> 

css

.wrapper {     width: 500px;     height: 200px;     /*border: 1px solid purple;*/ } .top-nav {     position: fixed;     top: 0;     border: 1px solid red;     background: transparent; }  .copy {     position: relative;     top: 40px;     border: 1px solid green;     overflow: hidden; } 

i believe impossible if want scrollbar on edge of browser, unless change design decision make top-nav transparent , else, such adding background colour or background image shows same thing.

if add 2 fixed containers* around scrollable part of page, set height < 100% , position them under top-nav, can set outer container hide overflow, , set inner container scroll on y-axis. not yield great results.

<div class="wrapper">     <div class="top-nav">this needs @ top</div>      <div id="outercontainer">         <div id="innercontainer">             <div class="copy"><p>this needs hide below top-nav user scrolls thru page.</p></div>         </div>     </div> </div> 

with css:

.outercontainer {     position: fixed;     top: 40px;     height: 90%;     width: 100%;     overflow: hidden; }  .innercontainer {     position: fixed;     height: 90%;     width: 100%;     overflow-y: scroll; } 

* tested in internet explorer 11. might horribly break in else


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -