第38天 实现单行文本居中和多行文本左对齐并超出显示"..."
Activity
wenyejie commentedon May 24, 2019
可惜多行文本省略, 有严重的兼容性问题
rocky-191 commentedon May 24, 2019
是啊,谷歌内核的才支持这个写法
tzjoke commentedon May 28, 2019
@rocky-191 ff68支持了
tzjoke commentedon May 28, 2019
@wenyejie 多行溢出不需要
text-overflow: ellipsis
吧DarthVaderrr commentedon Jul 4, 2019
多行文本溢出目前没有解决方案
Vi-jay commentedon Jul 29, 2019
ps:实现了单行居中 多行居左 但是没办法并且超出显示... 估计是用伪元素遮住最后几个文字显示...
jiamianmao commentedon Aug 11, 2019
愚兄前些年看过篇文章,与众贤弟分享一下。
单行居中显示文字,多行居左显示,最多两行超过用省略号结尾
justfn commentedon Sep 10, 2019
多行显示非Chrome只能使用JS来完成了啊, 写的一个方法 供参考
用法如下:
Konata9 commentedon Sep 17, 2019
单行文本居中。在
webkit
内核中适用。非webkit
内核,可以是用 js 或者用::after
模拟。多行文本左对齐。多行文本没有很好的解决方法,只能依赖 js 或者 css 的相对定位。
示例代码:https://codepen.io/Konata9/pen/RwbYbRG
canwdev commentedon Nov 11, 2019
可能是最全的 “文本溢出截断省略” 方案合集 - 掘金
zxl-lxz commentedon Mar 26, 2020
chenyuwen456456 commentedon Jun 28, 2020
blueRoach commentedon Jul 9, 2020
以上方法仅在高版本google和firefox适用
要想适配所有浏览器和低版本需要和JS一起实现,判断字数是否超过两行,然后只留下两个的字符再减2,再在最好加上......
hou499 commentedon Aug 20, 2020
纯css https://codepen.io/hou499/pen/OJNRezZ
第二种方法会让单行文本的标签也占两行但是较第一种来说兼容性好
可能是最全的 “文本溢出截断省略” 方案合集
smile-2008 commentedon Oct 28, 2020