title: Make flex container take width of content, not width 100%
body: <p>In the below example, I have a button with the following styles...</p>
  
  <pre><code>.button-flexbox-approach {
      /* other button styles */
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 1.5rem 2rem;
  }
  </code></pre>
  
  <p><a href="http://codepen.io/3stacks/pen/JWErZJ" rel="noreferrer">http://codepen.io/3stacks/pen/JWErZJ</a></p>
  
  <p>But it automatically scales to 100% instead of the width of the content. You can set an explicit width, but then that doesn't allow your text to wrap naturally.</p>
  
  <p>How can I make a button that has the inner text centered with flexbox, but doesn't grow to fit the size of the container?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
    width: 100%;
    height: 100%;
  }
  
  .button {
  /*   Simply flexing the button makes it grow to the size of the container... How do we make it only the size of the content inside it? */
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-appearance: none;
    border-radius: 0;
    border-style: solid;
    border-width: 0;
    cursor: pointer;
    font-weight: normal;
    line-height: normal;
    margin: 0;
    position: relative;
    text-align: center;
    text-decoration: none;
    padding: 1rem 2rem 1.0625rem 2rem;
    font-size: 1rem;
    background-color: #D60C8B;
    border-color: #ab0a6f;
    color: #fff;
  }
  
  .one {
    margin-bottom: 1rem;
  }
  
  .two {
  /* You can put an explicit width on that, but then you lose the flexibility with the content inside */
    width: 250px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;p&gt;
      Button one is flexed with no width and it grows to the size of its container
    &lt;/p&gt;
    &lt;p&gt;
      &lt;a class="button one" href="#"&gt;Button&lt;/a&gt;
    &lt;/p&gt;
    &lt;p&gt;
      Button two is flexed with an explicit width which makes it smaller, but we have no flexibility for changing the content
    &lt;/p&gt;
    &lt;p&gt;
      &lt;a class="button two" href="#"&gt;Button 2&lt;/a&gt;
    &lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>