实现单行文本居中和多行文本左对齐并超出显示"..."

.one {
  text-align: center
}

多行文本: .multi { overflow: hidden text-overflow: ellipsis display: -webkit-box -webkit-line-clamp: 3 -webkit-box-orient: vertical }
不过可惜的是兼容性太差,可以用下面的这个

.multi-text{
width: 50%;
height: 4.5rem;
line-height: 1.5;
padding: 20px;
background: lightblue;
overflow: hidden;
position: relative;
box-sizing: border-box;

&::after{
content: '...';
height: 1.5rem;
position: absolute;
bottom: 5px;
right: 5px;
}
}

 

猜你喜欢

转载自www.cnblogs.com/jack123/p/11757386.html
今日推荐