Centering highlight text on a flexbox element - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Centering highlight text on a flexbox element

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
.main {<!--  w ww . ja v a  2s. c  om-->
   background-color:Chartreuse;
   font-size:3em;
   font-family:sans-serif;
   line-height:2.9;
   display:inline;
}

.outer {
   width:51%;
   margin:auto;
   text-align:center;
   display:flex;
}
</style> 
 </head> 
 <body translate="no"> 
  <div class="outer"> 
   <div class="inner"> 
    <div class="main">
      Integer tincidunt. Vivamus quis mi. Phasellus nec sem in justo pellentesque facilisis. Etiam ultricies nisi vel augue. Sed magna purus, fermentum eu, tincidunt eu, varius ut, felis. 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials