Align a vertical centered flex element to the right - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Align a vertical centered flex element to the right

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 {<!--from   ww  w .j  a  v  a 2 s .  c  om-->
   display:flex;
   width:201px;
   height:201px;
   border:2px solid;
   align-items:center;
}

.parent>.child {
   width:51%;
   height:51%;
   border:3px solid Chartreuse;
   margin-left:auto;
}
</style> 
 </head> 
 <body> 
  <div class="parent"> 
   <div class="child"></div> 
  </div>  
 </body>
</html>

Related Tutorials