将img放到background中,将background-size设置为100%;只需要适配背景为img的元素的宽和高即可。 转载于:https://www.cnblogs.com/yuanxinru321/p/7344860.html