Margin-bottom not working in flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Container

Description

Margin-bottom not working in flexbox

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

.container {<!-- w ww. ja v  a 2 s .  co  m-->
   display: flex;
   position: relative;
   flex-wrap: wrap;
   justify-content: flex-start;
   align-items: stretch;
   min-height: 70vh;
   width: 70%;
   margin: 5% auto 8% auto;
   background-color: lightyellow;
}
.container p {
   margin-bottom: 2%;
}
.container h2 {
   color: orange;
   font-size: 34px;
}
.middle p:first-child {
   margin-top: 8%;
}
.bspace {
   margin-bottom: auto;
}
.box h2 {
   color: orange;
   text-align: center;
}
.left {
   display: flex;
   flex-flow: row wrap;
   align-items: center;
   justify-content: space-around;
   order: 1;
   width: 30%;
   border: 1px dashed red;
}
.middle {
   display: flex;
   flex-flow: column wrap;
   order: 2;
   width: 45%;
   border: 1px dashed green;
}


      </style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="left"> 
    <img src="https://www.java2s.com/style/demo/Safari.png" alt="Picture of kid"> 
    <img src="https://www.java2s.com/style/demo/Safari.png" alt="Picture of kid"> 
   </div> 
   <div class="middle"> 
    <h2 class="bspace"> Some Text </h2> 
    <p> Sample </p> 
    <p> Sample </p> 
    <p> Sample </p> 
    <p> Sample </p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials