【问题标题】:Images doesnt resize in flexbox图像不会在 flexbox 中调整大小
【发布时间】:2016-08-06 01:33:41
【问题描述】:

我有这个

.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 高度更改为 800 像素。我希望 .content 的文章下降,当它们达到 800px 时,再创建一个列。问题仍然存在, .content 的文章改为超出父框或调整大小...

【问题讨论】:

    标签: html css layout flexbox responsive


    【解决方案1】:

    试试这个:

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

    【讨论】:

    • 你有一些测试网址的演示吗?或者您可以在 jsfiddle.net 上指定您的问题吗?谢谢
    猜你喜欢
    • 2016-05-28
    • 2018-04-30
    • 2017-06-06
    • 2021-10-02
    • 1970-01-01
    • 2019-11-18
    • 2017-03-01
    • 2018-01-07
    • 1970-01-01
    相关资源
    最近更新 更多