title: Nested CSS-Grids and image resizing
body: <p>I'm learning CSS Grid and I have a problem with image resizing.</p>
  
  <p>To show you the problem, I created a main layout with 2 columns and inside the first column, I created another grid where I wanted to place an image and some text in a column.</p>
  
  <p>Please delete the html comment, so that you'll see the image.</p>
  
  <p>In the code snippet, the red area shows the cell where the image should go.
  Now, the image is larger than the red 'container' (height: 200px) grid-cell and I want the image to shrink inside the cell, so that it fits inside and keeps the aspect ratio (cut-offs left/right or top/bottom are needed). Object-fit on the image doesn't work. Positioning the image like "object-position: 50% 50%" would also be nice but that doesn't work either.
  I'm currently not sure how to fix this problem.</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>.mainlayout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  
  .media {
    grid-column: 1 / 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 200px auto auto;
  }
  
  .media .image {
    grid-column: 1;
    grid-row: 1;
    background-color: red;
  }
  
  .media h4 {
    grid-column: 1;
    grid-row: 2;
  }
  
  .media p {
    grid-column: 1;
    grid-row: 3;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section class="mainlayout"&gt;
    &lt;div class="media"&gt;
      &lt;div class="image"&gt;
        &lt;!--&lt;img src="http://placehold.it/1000x1000"&gt;--&gt;
      &lt;/div&gt;
      &lt;h4&gt;Card title&lt;/h4&gt;
      &lt;p&gt;Some quick example text to build on the card title and make up the bulk of the card's content.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/section&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you for your help.</p>