实现效果如下图,直接给我们的div加上这个class即可
单行文字超出隐藏显示…
.hidden-text {
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
white-space: wrap;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
margin-bottom: 20rpx;
}
两行文字超出隐藏显示…
.hidden-text {
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
white-space: wrap;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 20rpx;
}