效果:
实现代码与过程
.d2 {
width: 150px;
height: 80px;
background-color: pink;
margin: 100px auto;
/* 当行多余文字省略 */
/* 1.强制文字当行显示 */
white-space: nowrap;
/* 2.设置多余文字进行隐藏 */
overflow: hidden;
/* 3.设置多余部分用省略号显示 */
text-overflow: ellipsis;
}
: