title: flexbox space-between and align right
body: <p>I have a div with 1 to 3 items and I want them to behave like this : </p>
  
  <ol>
  <li><p>Three items : take the whole line with <code>justify-content: space-between</code></p>
  
  <pre><code>+-----------+
  | 1 | 2 | 3 |
  +-----------+
  </code></pre></li>
  <li><p>If there is only 1 item, align it to the right.</p>
  
  <pre><code>+-----------+
  |       | 3 |
  +-----------+
  </code></pre></li>
  </ol>
  
  <p>Here's my code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
    display: flex;
    width: 300px;
    justify-content: space-between;
    /* Styling only */
    padding: 10px;
    background: #ccc;
    margin-bottom: 10px;
  }
  .container div {
    /* Styling only */
    background: white;
    padding: 20px 40px;
    width: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div&gt;
      1
    &lt;/div&gt;
    &lt;div&gt;
      2
    &lt;/div&gt;
    &lt;div&gt;
      3
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="container"&gt;
    &lt;div&gt;
      3
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I've found a solution with <code>direction: rtl</code>, but I hope there's a less hacky solution, and I prefer not to reorder my dom. </p>
  
  <p>Any ideas?</p>