单行:
.element{
width:300px;
overflow: hidden;text-overflow:ellipsis;
white-space: nowrap;
}
多行(webkit浏览器):
.element{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
多行(多浏览器):
.element{
position: relative; line-height: 20px; max-height: 40px;overflow: hidden;
p::after{content: "..."; position: absolute; bottom: 0; right: 0; padding-left: 20px;
background: -webkit-linear-gradient(to right, transparent, #fff 55%);
background: -o-linear-gradient(to right, transparent, #fff 55%);
background: -moz-linear-gradient(to right, transparent, #fff 55%);
background: linear-gradient(to right, transparent, #fff 55%);
}