Page centered in Flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Page centered in Flexbox

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>Flexbox testing</title> 
  <style>
body, html {
   height:100%;
   width:100%;
}

.aligner {<!--from  w w w. ja  v  a2  s. c o  m-->
   height:100%;
   width:100%;
   display:-webkit-flex;
   display:flex;
   -webkit-align-items:center;
   align-items:center;
   -webkit-justify-content:center;
   justify-content:center;
}
</style> 
 </head> 
 <body translate="no"> 
  <div class="aligner"> 
   <h1>Flexbox Testing</h1> 
  </div>  
 </body>
</html>

Related Tutorials