Create two column layout with stacked div on the right - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Create two column layout with stacked div on the right

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> <!--from w  ww.  java  2  s  .  co  m-->
 <body> 
  <style type="text/css">
div {
   min-width:51px;
   min-height:51px;
   margin:9px;
   justify-content:flex-end;
}

#body {
   background:lightgray;
   padding:9px;
   display:flex;
   flex-wrap:wrap;
}

#box {
   background:lightpink;
   min-width:151px;
   height:221px;
   flex-grow:2;
}

.item {
   background:lightyellow;
}

#wrap {
   margin:0;
   border:solid green;
}

@media(orientation: portrait)  {
   #wrap {
      display:flex;
      flex-wrap:wrap;
      justify-content:flex-end;
      border:solid red;
   }
   
   #body {
      display:block;
   }

}
</style> 
  <title>Example</title> 
  <div id="body"> 
   <div id="box"></div> 
   <div id="wrap"> 
    <div class="item"></div> 
    <div class="item"></div> 
    <div class="item"></div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials