版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Headmaster_Tan/article/details/84937109
单行文本隐藏
.single-line-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
多行文本隐藏
.multiple-line-text {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /* 这是两行,多少行自己换个数字就是了 */
}
问题
-webkit-box-orient: vertical
可能会在webpack打包后消失掉导致出现问题,解决方案如下:
普通css:
/* autoprefixer: off*/
-webkit-box-orient: vertical;
/* autoprefixer: on*/
less:
/*! autoprefixer: off */
-webkit-box-orient: vertical;
/* autoprefixer: on */