Align the flex-item to left and right in flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Align

Description

Align the flex-item to left and right 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">

.parent-div {<!--from w  ww .  j av a  2s .  c  o m-->
   display: -webkit-flex;
   display: flex;
   -webkit-flex-direction: row;
   flex-direction: row;
   white-space: nowrap;
}
.second-left-div {
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
   min-width: 0;
   -webkit-align-self: flex-start;
   align-self: flex-start;
}
.left-div {
   -webkit-align-self: flex-start;
   align-self: flex-start;
}
.right {
   margin-left: auto;
   white-space: nowrap;
}
.inside-right {
   display: inline-block;
}


      </style> 
 </head> 
 <body> 
  <div class="parent-div"> 
   <div class="left-div">
     Left div 
   </div> 
   <div class="second-left-div">
     Test Test Test TEst test test 
   </div> 
   <div class="right"> 
    <div class="inside-right">
      1st Right 
    </div> 
    <div class="inside-right">
      2nt Right 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials