段落元素中有3列:
.foo {
display: flex;
align-items: center;
}
.column {
border: 3px solid blue;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

<p class="foo">
<span class="first column">first</span>
<span class="second column">second</span>
<span class="third column">third</span>
</p>
&#13;
规则是:
我不知道如何通过使用flex实现这一目标。有人可以给我一些解决方案吗?
答案 0 :(得分:1)
.foo {
display: flex;
}
.first { flex: 0 1 70%; } /* can't grow, can shrink, max width 70% */
.second { flex: 0 1 50px; } /* can't grow, can shrink, max width 50px */
.column {
border: 1px solid blue;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
<p class="foo">
<span class="first column">first first first first first first first first first first first first first first first first first first first</span>
<span class="second column">second second second second second second second second second </span>
<span class="third column">third third third third third third</span>
</p>