export const aspectRatio = (width, height) => {
height: 0,
overflow: ‘hidden‘,
paddingBottom: `${(height / width) * 100}%`,
}
padding-bottom 值为百分比时,百分比与其所在元素的父元素的宽度相关。
图片等比例缩放方案
原文:https://www.cnblogs.com/lee-xiumei/p/10237423.html