title: CSS Flexbox - Center a div between two divs
body: <p>I have a logo between a nav and a search button and I want to center the logo in the page. Using a horizontal auto margin makes the center div go to the right as the content on the left is larger.</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>.flexbox {
    display: flex;
  }
  .logo {
    margin: 0 auto;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="flexbox"&gt;
    &lt;div class="left-nav"&gt;
      &lt;a href="#"&gt;Link1&lt;/a&gt;
      &lt;a href="#"&gt;Link2&lt;/a&gt;
      &lt;a href="#"&gt;Link3&lt;/a&gt;
      &lt;a href="#"&gt;Link4&lt;/a&gt;
      &lt;a href="#"&gt;Link5&lt;/a&gt;
      &lt;a href="#"&gt;Link6&lt;/a&gt;
      &lt;a href="#"&gt;Link7&lt;/a&gt;
      &lt;a href="#"&gt;Link8&lt;/a&gt;
  
    &lt;/div&gt;
    &lt;div class="logo"&gt;
      Logo
    &lt;/div&gt;
    &lt;div class="right-search"&gt;
      search
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>