<div class="container">
  <p>
    Consider the following image: This following is an image that has been sized to fit inside its element box using the 
  </p>
  <img src="http://tympanus.net/codrops-playground/assets/images/cssref/properties/object-position/duck.jpg" alt="">
  <p>The image has been fitted inside its element box using the <code>object-fit</code> property. The value used here is <code>contain</code>. It has then been aligned using <code>object-position</code>. 
  </p>
  <p>Change the values of the <code>object-fit</code> and <code>object-position</code> properties to see the effect on the image content.</p>
  <img class="fit" src="http://tympanus.net/codrops-playground/assets/images/cssref/properties/object-position/duck.jpg" alt="">
</div>
body {
  color: #555;
  font-size: 1.1em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.container {
  margin: 40px auto;
  max-width: 700px;
}

img {
  max-width: 100%;
}

img.fit {
  border: 5px solid maroon;
  width: 10em;
  height: 10em;
  -o-object-fit: contain;
  object-fit: contain;
  -o-object-position: top left;
  object-position: top left;
}