title: horizontally center flex item
body: <p>Is it possible to horizontally center <code>.div2</code> without position <code>absolute/fixed</code> like this image?</p>
  
  <p><a href="https://i.stack.imgur.com/H5i8A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H5i8A.png" alt="enter image description here"></a></p>
  
  <p>div3 can change width</p>
  
  <p>Here's my code:</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 {
    margin:0;
  }
  
  .test {
    background:green;
    color:#fff;
    display:flex;
  }
  
  .test .div1 {
    
  }
  
  .test .div2 {
    margin:0 auto;
  background:red;
  }
  
  .test .div3 {
    margin:0 0 0 auto;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="test"&gt;
    &lt;div class="div1"&gt;Left options&lt;/div&gt;
    &lt;div class="div2"&gt;Center div&lt;/div&gt;
    &lt;div class="div3"&gt;Username: test (string can change)&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>