css - How to make a div scroll able when window height is reached -


i have developed template using bootstrap, following fiddle represents layout expected, want yellow area scroll able when content inside reaches window height, while right red panel remains fixed.

html

<div class="header"> header </div>  <div class="content">    <div class="left-panel">       <div class="dummy-content">           results       </div>        <div class="dummy-content">           results       </div>        <div class="dummy-content">           results       </div>        <div class="dummy-content">           results       </div>       <div class="dummy-content">           results       </div>        <div class="dummy-content">           results       </div>        <div class="dummy-content">           results       </div>   </div>   <div class="right-panel">     map   </div>  </div>  <div class="footer"> footer </div> 

css

body{   text-align:center;   width:100%;   height:100%; } .header{   background:black;    color:#fff;}  .left-panel{     background:yellow;     overflow-y: scroll;     float:left;     width:50%;     height:100%; } .dummy-content{     height:150px; } .right-panel{     background:tomato;     height:100%;     float:right;     width:50%; }  .footer{   background:grey;   position:absolute;   bottom:0;   width:100%;  }        .content > div{   display:inline-block;   vertical-align:top; }  .content{   clear:both; } 

my problem

  • how make content inside scroll when content increase , once window height reached
  • the footer should not overlap scroll able area when screen size changed
  • is possible provide css fix only

you can use calc() function , vh units achieve desired output :

.left-panel{   background:yellow;   overflow-y: scroll;   float:left;   width:50%;   height:calc(100vh - 40px); } 

see fiddle


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -