JSFiddle - React, Tailwind, and code Playground

by Michael Danilov

HTML

<div>
  <div class="es-products__photo one">
    <a href="#">
      <img src="http://d375s6m63z2p94.cloudfront.net/uploads/product/439-952482d72963aa7b578267a7e99ed99a.jpg" alt="" />
    </a>
  </div>
  <div class="es-products__photo two" style="background-image: url('http://d375s6m63z2p94.cloudfront.net/uploads/product/439-952482d72963aa7b578267a7e99ed99a.jpg');">
    <a href="#"></a>
  </div>
</div>
<div>
  <div class="es-products__photo one">
    <a href="#">
    <img src="http://static.epicsell.ru/1_53f46029c6f06_1408524329.jpg" alt="" />
    </a>
  </div>
  <div class="es-products__photo two" style="background-image: url('http://static.epicsell.ru/1_53f46029c6f06_1408524329.jpg');">
    <a href="#"></a>
  </div>
</div>

CSS

.es-products__photo {
    border: 1px solid #000;
    display: inline-block;
    height: 220px;
    margin: 10px;
    overflow: hidden;
    width: 220px;
}

.es-products__photo.one img {
    height: auto;
    max-height: 100%;
    min-height: 100%;
}

.es-products__photo.two {
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: none;
}

.es-products__photo.two a {
    display: block;
    height: 100%;
    width: 100%;
}