HTML
导入代码模板:
CSS object-fit
original images
img { width: 200px; height: 200px; border: 1px solid; background: #eee; }
Images squished
Previous style + img { object-fit: contain }
Images letterboxed, correct aspect ratio maintained
Previous style + img { object-fit: cover; }
Images expand to cover width and height, correct aspect ratio maintained
Previous style + img { object-fit: none; }