html - Push divs down in containing div with CSS -


i build sort of "stack" of divs (with class .inner) within containing div (#container) each inner pushed far down in container possible without overlapping inner. i've included illustrations of 1 , 3 inners, respectively:

example 1 inner example 3 inners

i know result on left setting...

#container { position: relative; }  .inner {    position: absolute;    bottom: 0; } 

...but solution not scale example on right - instead cause of inners overlap 1 another. there way accomplish want through css alone arbitrary number of inners? know hacky javascript.

you use additional container inner containers , use trick suggested.

    <style>  div{border:1px solid red}  #container{height:1000px;}  #inner-container{position:absolute;bottom:0px;}  .inner {height:200px;width:200px;margin:5px;; </style>   <div id="container">  <div id="inner-container">   <div class="inner"></div>   <div class="inner"></div>   <div class="inner"></div>  </div> </div> 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -