Css 在Chrome中,图像作为flex项不按最大宽度缩放
我在flex容器中有一个图像 图像在Chrome中保持其原始高度,不会按比例调整大小。然而,它在Firefox中工作Css 在Chrome中,图像作为flex项不按最大宽度缩放,css,image,google-chrome,flexbox,Css,Image,Google Chrome,Flexbox,我在flex容器中有一个图像 图像在Chrome中保持其原始高度,不会按比例调整大小。然而,它在Firefox中工作 <figure> <img src="image.jpg"> <a href="#">A link to somewhere</a> </figure> figure { display: flex; width: 100%; } figure img { max-width: 50%; hei
<figure>
<img src="image.jpg">
<a href="#">A link to somewhere</a>
</figure>
figure {
display: flex;
width: 100%;
}
figure img {
max-width: 50%;
height: auto;
}
身材{
显示器:flex;
宽度:100%;
}
图img{
最大宽度:50%;
高度:自动;
}
默认情况下,Flex使其子项的高度相等。要禁用此行为,可以指定align items:flex start