在下面的HTML中,我希望省略号显示在cell2中。如果cell2是块元素,则会发生这种情况,但如果它是内联块元素,则不会发生(尽管各种来源状态否则)。
我如何使inline-block元素显示文本省略号?
我如何使inline-block元素显示文本省略号?
.outer {
width: 200px;
height: 400px;
background-color: whitesmoke;
overflow: hidden;
white-space: nowrap;
}
.cell1 {
background: red;
display: inline-block;
}
.cell2 {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: block;
}
<div class="outer">
<span class="cell1">hey</span>
<span class="cell2">
hi there, this is a very long block of text
</span>
</div>