【发布时间】:2016-10-18 07:18:22
【问题描述】:
我有一个模块:
.container {
width: 250px;
height: 50px;
background: #fffff3;
}
.truncate {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
<div class="container">
<p class="truncate">
<span>Some loooooooooooong name</span>
:
<span>1.7m</span>
m Tall
</p>
</div>
应该呈现为:
一些客户姓名:1.7m 高
我希望它被截断,这样如果名称太长,它看起来像:
一些长名字……:1.7m 高
我尝试过使用上面的 truncate 类,但它看起来像这样:
一些 looooooooooooong 的名字......
用户高度离开屏幕。我能做些什么来纠正这个问题?
【问题讨论】:
-
有什么问题?高度?然后删除
height: 50px;? -
@nicael - 我相信 OP 是指文字
1.7m Tallby height -
啊,我明白了,谢谢@j08691。
-
@nicael 道歉没有说清楚!