我有以下标记。我可以让孩子1和孩子2充当方向行(没有附加的html标记)吗?子项1应该表现为内联块,而子项2会像子项3一样扩展到可用宽度和省略号的其余部分。
我如何使子级1具有内联块宽度,而子级3占用其余宽度而没有像flex:0 0 90%这样的硬编码flex百分比?
.flex-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
overflow: hidden;
}
.child {
border: 1px solid red;
margin-right: 10px;
padding: 5px;
}
.two,
.three {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
<div class="flex-container">
<div class="child one">
01
</div>
<div class="child two">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
<div class="child three">
Vestibulum accumsan enim nec ipsum. Nunc cursus sapien. Etiam fermentum luctus arcu. Curabitur vitae velit eget nisl ornare sollicitudin.
</div>
</div>