【发布时间】:2017-10-03 04:39:06
【问题描述】:
我无法让text-overflow: ellipsis 工作,我希望有人能发现我找不到的错误。这是我的代码:
HTML:
<div class="out">
<div class="in1"></div>
<div class="in2">some long random text which should not fit in here</div>
</div>
CSS:
* {
box-sizing: border-box;
}
.out {
display: block;
height: 60px;
width: 250px;
border-bottom: 1px solid #eee;
cursor: pointer;
color: #000;
background: lightgreen;
}
.in1 {
height: 60px;
width: 60px;
padding: 10px;
float: left;
border: 1px solid red;
}
.in2 {
float: left;
height: 60px;
line-height: 60px;
width: 190px;
text-overflow: ellipsis;
overflow: hidden;
font-size: 1.1em;
border: 1px solid blue;
}
JSFiddle:http://jsfiddle.net/59m5e6ex/
我找到了this,但据我所知,我的div 满足所有要求。
【问题讨论】:
-
只需将 white-space: nowrap: 添加到您的 .in2 类中
-
添加
white-space: nowrap;应该有帮助