当我有ellipsis
长词时,它会中断id:
并[ ]
进入不同的行。我似乎无法将它们一行一行地放在一起。我试过white-space: nowrap
和display: inline-block
。有任何想法吗?
https://jsfiddle.net/b35m449x/4/
HTML
<div class="container">id: [<div class="trunc">userrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr</div>]</div>
CSS
.container {
display: inline-block;
white-space: nowrap;
border: 1px solid black;
width: 100%;
}
.trunc {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
}