Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 在Chrome中,图像作为flex项不按最大宽度缩放_Css_Image_Google Chrome_Flexbox - Fatal编程技术网

Css 在Chrome中,图像作为flex项不按最大宽度缩放

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

我在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%;
 height: auto;
}

身材{
显示器:flex;
宽度:100%;
}
图img{
最大宽度:50%;
高度:自动;
}

默认情况下,Flex使其子项的高度相等。要禁用此行为,可以指定
align items:flex start