Horizontally Centering Flexbox with Image and Text - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Horizontally Centering Flexbox with Image and Text

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>

.content {<!--from  ww w.jav a 2s .  c  om-->
   width: 400px;
   display: flex;
   justify-content: center;
   align-items: center;
   background: #ccc;
   padding: 40px;
}


      </style> 
 </head> 
 <body translate="no"> 
  <div class="window"> 
   <div class="content"> 
    <img src="https://www.java2s.com/style/demo/Opera.png"> 
    <div class="textcontent"> 
     <div class="text">
       Some text that is very very long and wraps. 
     </div> 
     <div class="text">
       This text is also very long and also wraps. 
     </div> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials