似乎flex-basis不能否决溢出的子节点,例如当white-space:nowrap生效时。在下面的示例中,如果我删除white-space:nowrap,flex-basis按预期工作。强制宽度为80px的唯一方法是使用max-width。这是实现这种行为的正确方法吗?
<div class="parent">
<div class="button">
<div class="text">
Overflow Me
</div>
</div>
</div>
.parent {
background: beige;
display: flex;
.button {
flex: 0 1 80px;
display: flex;
.text {
background: lightblue;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}