title: How do I center an image in flexbox?
body: <p>How do I center an image in flex box? I tried using justify-content and align-items to center but it didnt work. </p>
  
  <p>In the code down below, i set my   to a green box. I want to center the green box within the red box. Any help?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.body{
   display: flex;
   flex: 1;
   width: 250px;
   height: 250px;
   background-color: blue;
   padding: 10px;
  }
  .innerDiv1{
   flex: 1;
    background-color:red;
  }
  .innerDiv2{
   flex: 1;
   background-color: yellow;
  }
  .innerDiv3{
  flex: 1;
   width: 50px;
   height: 50px;
   background-color: green;
   align-items: center; /*does not work*/
   justify-content: flex-end; /*does not work*/
   
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class = "body"&gt;
   &lt;div class = "innerDiv1"&gt;
     &lt;div class = "innerDiv3"&gt;
     &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class = "innerDiv2"&gt;
   &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>