Auto adjust height of children divs inside a div container - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Parent Container

Description

Auto adjust height of children divs inside a div container

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
* {<!--from  w  ww . ja va 2  s.co  m-->
   box-sizing:border-box;
}

.parent {
   display:flex;
   flex-direction:column;
   width:801px;
   height:301px;
   border:3px solid Chartreuse;
}

.child1 {
   flex-grow:2;
   width:601px;
   border:2px solid yellow;
   overflow-y:scroll;
}

.child2 {
   flex-grow:2;
   width:601px;
   border:2px solid blue;
   overflow-y:scroll;
}
</style> 
 </head> 
 <body> 
  <div class="parent" style=""> 
   <div class="child1">
     child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> child1 
    <br> 
   </div> 
   <div class="child2">
     child2 
    <br> child2 
    <br> child2 
    <br> child2 
    <br> child2 
    <br> child2 
    <br> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials