title: Flexbox CSS rows not shrinking to fit inside container
body: <p>I have a flexbox container with a fixed height and width, and some flex rows inside, each containing SVG objects.</p>
  
  <p>When I add more SVGs to one row, the other SVGs in the row shrink to fit the container's width.
  However, if I add more rows, they don't shrink to fit the container and instead overflow.</p>
  
  <p>How can I prevent such behavior, and instead have the rows shrink properly to fit inside the container?</p>
  
  <p>Example code (first row shows the horizontal shrinking; notice the two bottom rows overflow the div-page container):</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>html,
  body {
    margin: 0;
    padding: 0;
    height: 100%;
  }
  
  .row {
    flex: 1;
    flex-direction: row;
    display: flex;
    align-items: flex-start;
    width: 100%;
  }
  
  .div-page {
    display: flex;
    flex-direction: column;
    height: 420mm;
    padding: 10mm;
    overflow: hidden;
  }
  
  object {
    max-width: 25%;
    max-height: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body style="width: 594mm;"&gt;
    &lt;div class="div-page"&gt;
      &lt;div class="row"&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
        &lt;object data="https://upload.wikimedia.org/wikipedia/commons/5/59/Logo_test.svg" type="image/svg+xml" style=""&gt;&lt;/object&gt;
      &lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>