最近更新的Chrome 中断white-space: nowrap
使用元素。如何在不在类上添加硬编码宽度的情况下解决这个问题..text-overflow: ellipsis;
overflow: hidden
name
<h1>problem</h1>
<div class="container">
<div class="name">
<div class="firstname">
test
</div>
<div class="lastname">
as kjldashdk ja asdjhk ashdjk ashdjk asdjasdkajsdh akjsd asd asd asd asd asd asd as das da asdas dasd asda sdasd as dasd asd asd as dasd a
</div>
</div>
<div class="side">
options
</div>
</div>
结构不应该改变,因为我.name
在我的应用程序的其他地方重用了该部分。
.container {
width: 800px;
height: 80px;
display: flex;
border: solid 1px black;
margin: 10px;
}
.name {
display: flex;
}
.firstname {
width: 100px;
background-color: grey;
}
.lastname {
flex-grow: 1;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.side {
flex-grow: 0;
}
.side, .firstname, .lastname {
align-self: center;
padding: 0 20px;
}