l-hammer / You-need-to-know-css

💄CSS tricks for web developers~
https://lhammer.cn/You-need-to-know-css/
Other
5.31k stars 610 forks source link

文本截断 #73

Open l-hammer opened 5 years ago

l-hammer commented 5 years ago

https://lhammer.cn/You-need-to-know-css/#/zh-cn/text-truncate

You-need-to-know-css,CSS tricks web developers need to know

2601178727 commented 5 years ago

多行文本截断在火狐上会有兼容问题,大众的解决方案是用伪类模拟... 笔者有什么优雅的解决方案么?

l-hammer commented 5 years ago

@2601178727 纯CSS并不能完美的实现多行文本截取,目前比较巧妙的方案都是通过float + 伪元素 + 渐变实现,如果想优雅的实现还是建议通过JS来实现,推荐看下shave这个库~