cropping photo css code example Example 1: crop image css .img { object-fit: contain; } Example 2: how to crop images in css img{ object-fit: cover; }