文本溢出及其在angular中失效的bug

单行文本溢出:

overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;

多行文本溢出:

.mui-ellipsis-2 {
    line-height: 24px;
    display: -webkit-box;
    overflow: hidden;
    white-space: normal !important;
    text-overflow: ellipsis;
    word-wrap: break-word;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical
}

问题:

  1. 在angular(7.x)项目中,多行文本溢出没有生效,为什么????
  2. 在display:flex;布局的时候,单行都没有生效。

参考:
https://blog.csdn.net/niesiyuan000/article/details/87929214
https://blog.csdn.net/xiaoqingpang/article/details/78952621

https://github.com/josephschmitt/Clamp.js
https://www.html.cn/archives/5206/

解决办法:多行在angular中失效的原因:
参考:
https://blog.csdn.net/Candy_home/article/details/79646655

默认编译的时候,会过滤 -webkit-box-orient: vertical;
改变方式,关闭 autoprefixer 然后再开启:用注释就可以做到,简直黑科技,eg:

 /* autoprefixer: off */
  -webkit-box-orient: vertical;
  /* autoprefixer: on */

尝试下这个指令:
Angular2~6 Text-Ellipsis 多行文本显示组件:
https://www.jianshu.com/p/e27060ccfd87

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值