我有这样的代码示例:
<div class="container">
<div class="item n1">Proe Schugaienz</div>
<div class="item n2">Proe Schugaienz</div>
</div>
我使用这样的jQuery代码:
$('.item').dotdotdot({
wrap: 'word',
fallbackToLetter: false
})
和CSS:
.item {
margin: 5px;
background: red;
padding: 2px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.n1 {
width: 8px;
}
.n2 {
width: 80px;
}
但结果我得到:
结果我想实现这个:
纯css或dotdotdot.js有可能吗?如果单词(句子)不能匹配它的父级:然后只显示默认的单行文本溢出如果单词(句子)能够逐字匹配父级 - 然后匹配它,没有字母连字符!
所以我不希望我的容器被高度扩展(我有很多数据,这只是一个例子,我无法对某些块进行硬编码)