gpt4 book ai didi

html - div在flexbox中被下推

转载 作者:行者123 更新时间:2023-11-28 16:33:33 25 4
gpt4 key购买 nike

我想防止绿色 div (.c) 被向下推到容器外。

http://codepen.io/anon/pen/vLpPRM?editors=1100

<section>
<div class="a">aaaaaaaa</div>
<div class="b">bbbbb</div>
<div class="c">ccccccccc</div>
</section>

section
display: flex
flex-wrap: wrap
width: 500px
height: 200px
background-color: peru

.a
width: 400px
height: 100px
background-color: gray
.b
width: 100px
height: 200px
background-color: tan

.c
background-color: green
height: 100px
width: 300px

最佳答案

它的

section {
flex-wrap: no-wrap
}

section {
display: flex;
flex-wrap: no-wrap;
width: 500px;
height: 200px;
background-color: peru;
}

.a {
width: 400px;
height: 100px;
background-color: gray;
}

.b {
width: 100px;
height: 200px;
background-color: tan;
}

.c {
background-color: green;
height: 100px;
width: 300px;
}
<section>
<div class="a">aaaaaaaa</div>
<div class="b">bbbbb</div>
<div class="c">ccccccccc</div>
</section>

关于html - div在flexbox中被下推,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34935866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com