文字溢出用...代替

/*单行*/
p {
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis;
}
/*多行*/
p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/*多行兼容*/
p {
  position: relative;
  line-height: 1.4em;
  height: 4.2em;
  overflow: hidden;
}

p::after {
  content: "...";
  font-weight: bold;
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 0 20px 1px 3px;
  background: #fff;
}

 

posted @ 2017-04-17 16:22  sailiting  阅读(116)  评论(0)    收藏  举报