Center Image inside of a flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Center

Description

Center Image inside of a 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">

.splash-container {<!--from w  w w  .  j a  v  a2s  .  co  m-->
   display: flex;
   height: 90vh;
   flex-direction: column;
   text-align: center;
   border: 10px solid goldenrod;
   justify-content: space-around;
}

.logo {
   flex-shrink: 1;
   background: red;
}

.logo img {
   max-width: 100%;
   max-height: 80%;
}

.mission {
   background: yellow;
}


      </style> 
 </head> 
 <body> 
  <div class="splash-container"> 
   <div class="logo"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
   <div class="mission"> 
    <h1>Mission Statement</h1> 
    <p>this is a test this is a test this is a test this is a test 
    this is a test this is a test this is a test this is a test 
    this is a test this is a test this is a test this is a test this is a test 
    this is a test this is a test this is a test this is a test this is a test 
    this is a test this is a test this is a test this is a test this is a test 
    this is a test this is a test this is a test this is a test </p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials