- 单行超出范围展示省略号
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
- 多行超出范围后展示省略号(以两行为例)
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
/* 关闭autoprefixer的自动删除功能,否则-webkit-box-orient会被webpack打包干掉,这是autoprefixer插件的问题 */
/* autoprefixer: off */
-webkit-box-orient: vertical;
/* autoprefixer: on */
-webkit-line-clamp: 2;
text-overflow:ellipsis;
注意:多行时候的标签需要设置高度
本文介绍如何使用CSS实现单行或多行文本溢出时显示省略号的效果,包括white-space、overflow和text-overflow属性的用法,以及多行省略号的特殊处理方式。
3268

被折叠的 条评论
为什么被折叠?



