get an absolutely positioned item inside a relatively positioned flexbox container to grow - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Row

Description

get an absolutely positioned item inside a relatively positioned flexbox container to grow

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">

body {<!--   w  w  w.ja va 2s  .  c  o m-->
   width:300px;
   height:600px;
   margin:0;
}
html {
   width:100%;
   height:100%;
}
.container {
   position:relative;
   width:100%;
   height:100%;
   background:blue;
   display:flex;
   flex-direction:row;
   align-content:stretch;
}
.item {
   flex: 1 1 0;
   height: 10%;
   margin-top: 10%;
   min-width: 50%;
}


      </style> 
 </head> 
 <body> 
  <div class="container"> 
   <div style="background:tomato" class="item"></div> 
   <div style="background:cyan" class="item"></div> 
  </div> 
  <br> 
  <div class="container"> 
   <div style="background:tomato" class="item"></div> 
  </div>  
 </body>
</html>

Related Tutorials