Chrome v75:在flex列div中拉伸了最大宽度的图像

时间:2019-06-10 11:00:13

标签: html css google-chrome flexbox

自从更新的Chrome版本(75.0.3770.80)起,我网站上的图像很少被拉伸。

这些图像位于div中,具有以下属性:

<div class="column">
    <img
        :src="insuranceLogo"
        class="insurance"
    >
    <span>
        {{ offer.offer_name }}
    </span>
</div>

.column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.insurance {
    width: 100%;
    max-width: 150px;
}

直到今天,它的运行状况都很好,但是在新的Chrome版本中,我的图像全部拉长了!

我尝试使用较旧的Chrome版本,没关系,所以我将其更新为新版本:相同的结果,得到了扩展。

我的解决方案是将img标签包装在div中。但是我很好奇为什么这种行为会改变。

谢谢! :)

2 个答案:

答案 0 :(得分:2)

我知道这不能回答您的主要问题:“为什么这种行为发生了变化?”。

只需发布另一个可能的解决方案。为图像元素设置flex-basis: 0;对我有用。

.insurance {
    width: 100%;
    max-width: 150px;
    flex-basis: 0;
}

答案 1 :(得分:2)