title: CSS flex: Contain content within flex container
body: <p>I noticed when using <code>flex</code> that the container's content is allowed to overflow the container (column). How can I prevent this? I would like the content to have the max height and max width of whatever the column size is.</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>.row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
  }
  [class*='col-'] {
    flex: 1;
  }
  .col-6 {
    -ms-flex-preferred-size: 50%;
    flex-basis: 50%;
    max-width: 50%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="row" style="height:250px;"&gt;
  
    &lt;div class="col-6" style="background:red;"&gt;
  
    &lt;/div&gt;
    &lt;!-- /.col-6 --&gt;
  
    &lt;div class="col-6" style="background:blue;"&gt;
  
      &lt;img src="https://pixabay.com/get/e83cb50c2ff1043ed1584d05fb0938c9bd22ffd41db9154792f2c47fa6/discus-fish-1943755_1280.jpg" /&gt;
  
    &lt;/div&gt;
    &lt;!-- /.col-6 --&gt;
  
  &lt;/div&gt;
  &lt;!-- /.row --&gt;</code></pre>
  </div>
  </div>
  </p>