我试图使红色框与黑色框线中的flex容器宽度相同。
.container {
display: flex;
width: 80%;
margin: auto;
column-gap: 1em;
outline: 1px solid black;
}
.a {
background: #f002;
flex: 3;
}
.b {
background: #00f2;
flex: 2;
}
.box {
background: #f0f2;
margin: 1em 0;
padding: 1em;
}
.fw {
background: red;
}
<div class="container">
<div class="a">
<div class="box">
A
</div>
<div class="box fw">
B
</div>
<div class="box">
C
</div>
</div>
<div class="b">
<p>Some text here</p>
</div>
</div>
1条答案
按热度按时间oxf4rvwz1#
这就是你在这个例子中可以做的。如果第一列和第二列之间的比例改变了,代码可能需要改变。