html - CSS overflow auto doesn't work when container has min and max height -


i have container div min , max height.

inside there 2 column style divs 1 width 80% , other 20%

the 1 80% have <img /> taking full height , width of container.

the 20% 1 have thumbnails. set overflow auto on 1 user can scroll through thumbnails , select one, overflow auto not having effect. cannot set exact height of container must variable.

how can overflow scroll bar working in div thumbnails ?

please refer plunker: https://plnkr.co/edit/el2knvejdpufa6v24utv?p=preview

code:

<div class="container">     <div class="gallery-main">       <div class="img-container">         <img src="http://lorempixel.com/800/600" alt="">       </div>     </div>     <div class="gallery-list">         <img src="http://lorempixel.com/800/600?test=1" alt="">         <img src="http://lorempixel.com/800/600?test=2" alt="">         <img src="http://lorempixel.com/800/600?test=3" alt="">     </div> </div> <style>  .container{     min-width: 420px;     min-height: 316px;     max-height: 337px;     max-width: 540px; } .gallery-main{     width: 79%;     display: inline-block;     vertical-align: top;     max-height: inherit;     height: 100%;     text-align: center; } .gallery-list {     width: 20%;     overflow: auto;     display: inline-block;     vertical-align: top;     height: inherit;     max-height:100%; }  .gallery-list img {     width: 100%;     height: auto;     margin: 5px 0;     border-radius: 5px; } .img-container {     height: inherit;     width: 100%;     display: inline-block;     max-height: inherit; } .img-container img {     border-radius: 5px;     max-height: 100%;     max-width:100%; } </style> 

solution have position of relative on container , absolute on misbehaving divs. (it appears, css not exact science). updated plunker solution others can find it: https://plnkr.co/edit/el2knvejdpufa6v24utv?p=preview

edit: here's snippet mine. think want.

<!doctype html>  <html>      <head>      <link rel="stylesheet" href="style.css">      <script src="script.js"></script>      <style>  .container{        min-width: 420px;      min-height: 316px;      max-height: 337px;      max-width: 540px;      position: relative;  }  .gallery-main{      width: 79%;      display: inline-block;      vertical-align: top;      max-height: inherit;      height: 100%;      text-align: center;  }  .gallery-list {      width: 20%;      overflow: auto;      display: inline-block;      vertical-align: top;      height: inherit;    max-height:100%;    position: absolute;  }    .gallery-list img {      width: 100%;      height: auto;      margin: 5px 0;      border-radius: 5px;  }  .img-container {      height: inherit;      width: 100%;      height: 100%;      display: inline-block;  }  .img-container img {      border-radius: 5px;      height: 100%;      width:100%;  }      </style>    </head>      <body>      <div class="container">      <div class="gallery-main">        <div class="img-container">          <img src="http://lorempixel.com/800/600" alt="">        </div>      </div>      <div class="gallery-list">          <img src="http://lorempixel.com/800/600?test=1" alt="">          <img src="http://lorempixel.com/800/600?test=2" alt="">          <img src="http://lorempixel.com/800/600?test=3" alt="">          <img src="http://lorempixel.com/800/600?test=4" alt="">          <img src="http://lorempixel.com/800/600?test=5" alt="">          <img src="http://lorempixel.com/800/600?test=6" alt="">          <img src="http://lorempixel.com/800/600?test=7" alt="">          <img src="http://lorempixel.com/800/600?test=8" alt="">          <img src="http://lorempixel.com/800/600?test=9" alt="">          <img src="http://lorempixel.com/800/600?test=10" alt="">          <img src="http://lorempixel.com/800/600?test=11" alt="">      </div>    </div>    </body>    </html>


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -