【发布时间】:2016-07-28 13:14:55
【问题描述】:
我连续三个 div。第一个应该是固定的,第二个应该扩展直到达到“最大宽度”,第三个 div 应该占用剩余空间。它可以正常工作,直到第三个 div 的文本达到整个宽度。而不是仅仅包装它的文本开始使第二个 div 更小。
<div id="container">
<div id="one">
sdfsdf
</div>
<div id="two">
fghfgh fghfghd sdf sdf sdf ssdf sdf gh
</div>
<div id="three">
sdfsdfsdfsdfsfd sdf sdf sdf sdf sdfwef sdfwefs df
</div>
</div>
#container{
background-color: red;
display: flex;
height: 100px;
width: 400px;
}
#one{
background-color: blue;
flex-grow: 1;
width:60px;
}
#two{
background-color: red;
max-width: 100px
}
#three{
background-color: green;
flex-grow: 1;
}
你可以找到一个 jsfiddle here。
【问题讨论】: