title: Scale Image with Center crop by maintaining Aspect Ratio using CSS
body: <p>I want to create Image gallery like Mobile gallery . each Image should be in square box inside main container.</p>
  
  <p>Image shouldn't be stretched instead crop or clip at maximum. 
  now i stretch image with aspect ratio using this code,</p>
  
  <pre><code>img {
    max-width : 150px;
    max-height : 150px;
  }
  </code></pre>
  
  <p>it gives me minimized thumbnail of each image. but i want to make all inside square box with center clipped or cropped image.</p>
  
  <p>here is the example i want, 
  <a href="https://i.stack.imgur.com/J7U36.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J7U36.png" alt="enter image description here"></a></p>