contain
#img1 { object-fit: contain; }
cover
#img2 { object-fit: cover; }
Pro tip: use ```triple backticks around text``` to write in code fences