处理文字溢出和多行打点(附:stylus版)
注意:首先你的编辑器要支持stylus
文字溢出:
.hide{
width: 20px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
多行打点:
.hides{
width: 20px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: l;
-webkit-box-orient: vertical;
word-break:break-all;
word-wrap:break-word;
}
stylus:
新建stylus文件:common.styl
$txtHs(e, l){
width e;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: l;
-webkit-box-orient: vertical;
word-break:break-all
word-wrap:break-word
}
$txtH(e){
width e;
overflow hidden;
white-space nowrap;
text-overflow ellipsis;
}
在CSS文件中引入:
@import "common.styl"
.wrap
$txtHs(100px, 6)