img { object-fit: contain; /* Or 'cover' depending on design needs */ width: 100%; height: auto; }