title: How to center align a flexbox container?
body: <p>I successfully created a responsive grid as the snippet shows.</p>
  
  <p>At the moment, I see the boxes aligned to the left.</p>
  
  <p>How can I put the container in the center of the page without having to use padding?</p>
  
  <p>I tried using <code>margin:auto</code> but it did not work. </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>.container{
      display:flex;
      flex-wrap:wrap;
      text-align:center;
      margin:auto;
  }
  .box{
      width:100%;
      max-width:30%;
      border:1px solid red;
      margin:5px;
  }
  @media only screen and ( max-width:768px ){ 
      .box{
          width:100%;
          max-width:40%;
          border:1px solid red;
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section class="container"&gt;
      &lt;div class="box"&gt;
          &lt;h1&gt;This is the first box&lt;/h1&gt;
          &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci voluptates, aut totam eaque possimus molestiae atque odio vero optio porro magni, quis culpa ea. Perferendis, neque, enim. Rem, quia, quisquam.&lt;/p&gt;
      &lt;/div&gt;
  &lt;/section&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/cx1svoky/1/" rel="noreferrer">JS Fiddle</a>.</p>