html - 图像不会在 flexbox 中调整大小

标签 html css layout flexbox responsive

我有这个

.parentcontainer
{
background-color: black;
max-width: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: space-around;


}

.aside
{
display:flex;
flex: 30%;

flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;



}
.content
{

background-color: blue;
flex: 70%;
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: space-between;
align-content: flex-start;
max-height:800px;


}

.content img
{
width: 100%;
max-width: 100%;
height: auto;
}

当我调整浏览器大小时,.content 的 imgs 不会调整大小,我需要进行水平滚动。我该怎么做才能调整图像大小?并且子容器不会比父容器大。谢谢。

编辑:现在我将 .content 更改为列,并将 mas 高度更改为 800px。我想让 .content 的文章下降,当它们达到 800px 时,再创建一个专栏。问题仍然存在,.content 的文章改为超出父框或调整大小...

最佳答案

试试这个:

.content img{
    width: 100%;
    max-width: 100%;
    height: auto
}

关于html - 图像不会在 flexbox 中调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36624081/

相关文章:

html - 悬停不能按预期工作

javascript - 具有多个子项的 Accordion 菜单(面板)

javascript - 更改 div 标签内的光标速度

android - 移动兼容网站如何处理性能?

html - Bootstrap竖写

css - 为什么我的两列在 IE7 中不能正确对齐?

html - css @-moz-keyframes 动画不适用于 firefox 18.0.1

HTML 表头不显示,如何修复?

css - 如何在隐藏滚动条的同时使 DIV 居中?

c# - 创建一个方形边框,内部有图像,宽度和高度取决于统一的网格列