CSS实现文本溢出的部分用省略号代替的方法【...】

一、单行溢出

必须得有 width

width:300px;    
overflow: hidden;    
text-overflow:ellipsis;    
white-space: nowrap;

二、多行溢出

display: -webkit-box;   
-webkit-box-orient: vertical;   
-webkit-line-clamp: 2;   
overflow: hidden;  
  1. -webkit-box-orient: 排列方式
  2. -webkit-line-clamp: 一个块元素显示的文本的行数

友情链接:链接

猜你喜欢

转载自blog.csdn.net/weixin_43814775/article/details/113851516