title: How to fit (cover) an image inside span tag?
body: <p>I have this code below working perfectly, but I had to use imgcheckbox plugin for the image be selected when clicked (as google photos).</p>
  
  <p><strong>Example 1 is working the way i want. But when I use the plugin, it inserts a span tag for each image, so css doesnt work as Example 2</strong></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>body {
    width: 500px;
    margin: 0 auto;
  }
  
  div.main {
    display: flex;
    flex-wrap: wrap;
  }
  
  img {
    flex-grow: 1;
    margin: 2px;
    object-fit: cover;
    height: 150px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main"&gt;
    &lt;img src="https://picsum.photos/200/350/?random"&gt;
    &lt;img src="https://picsum.photos/600/400/?random"&gt;
    &lt;img src="https://picsum.photos/350/125/?random"&gt;
    &lt;img src="https://picsum.photos/180/310/?random"&gt;
    &lt;img src="https://picsum.photos/250/300/?random"&gt;
    &lt;img src="https://picsum.photos/220/300/?random"&gt;
    &lt;img src="https://picsum.photos/225/305/?random"&gt;
    &lt;img src="https://picsum.photos/200/300/?random"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Example 2:</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>body {
    width: 500px;
    margin: 0 auto;
  }
  
  div.main {
    display: flex;
    flex-wrap: wrap;
  }
  
  img {
    flex-grow: 1;
    margin: 2px;
    object-fit: cover;
    height: 150px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main"&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/200/350/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/600/400/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/350/125/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/180/310/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/250/300/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/220/300/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/225/305/?random"&gt;&lt;/span&gt;
    &lt;span&gt;&lt;img src="https://picsum.photos/200/300/?random"&gt;&lt;/span&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>