文本超出一行隐藏显示...

主要就是用ellipsis来实现,必须有宽度和高度,必须写overflow: hidden;才能够实现哦

1、单行溢出隐藏

.list-title{
line-height: 26px;
text-align: center;
font-size: 14px;
color: #333;
font-weight: bold;
height: 26px;
overflow: hidden;
text-overflow:ellipsis;
-o-text-overflow:ellipsis;
-webkit-text-overflow:ellipsis;
-moz-text-overflow:ellipsis;
white-space:nowrap;
}

 2、多行溢出隐藏

.list-title {
    width:100px; overflow: hidden; text
-overflow: ellipsis; display: -webkit-box; /* 将对象作为弹性伸缩盒子模型显示 */ -webkit-line-clamp: 4; /* 控制最多显示几行 */ -webkit-box-orient: vertical; /* 设置或检索伸缩盒对象的子元素的排列方式 */ }

 

posted @ 2019-07-25 09:32  珊珊家的小孩  阅读(1481)  评论(0编辑  收藏  举报