I want to show an image from an URL with a certain width and height even if it has a different size ratio. So I want to resize (maintaining the ratio) and then cut the imag
Live Example: https://jsfiddle.net/de4Lt57z/
HTML:
CSS:
.crop img{
width:400px;
height:300px;
position: absolute;
clip: rect(0px,200px, 150px, 0px);
}
Explanation: Here image is resized by width and height value of the image. And crop is done by clip property.
For details about clip property follow: http://tympanus.net/codrops/2013/01/16/understanding-the-css-clip-property/