- 单行文本:
.singleText{
//记得一定要给div宽度
width:200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
- 多行文本:
.moreText{
//记得一定要给div宽度
width:200px;
white-space: normal;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;
}
- 兼容英文
word-break: break-all;