CSS 文字溢出:ellipsis在IE上不起效果的解决

设置text-overflow: ellipsis;即可实现文本溢出省略的效果,本文主要介绍了CSS 文字溢出:ellipsis在IE上不起效果的解决,具有一定的参考价值,感兴趣的可以了解一下

单行文本的溢出显示省略号

p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

多行文本的溢出显示省略号

方法一:

p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; text-overflow: ellipsis; }

适用范围:
因使用了WebKit的CSS扩展属性,该方法适用于WebKit浏览器及移动端;不兼容IE浏览器。

方法二:

p { position:relative; line-height:20px; height:60px; overflow:hidden; } p::after { content:"..."; position:absolute; bottom:0; right:0; padding-left:45px; background: -webkit-linear-gradient(left, transparent, #fff 55%); background: -o-linear-gradient(right, transparent, #fff 55%); background: -moz-linear-gradient(right, transparent, #fff 55%); background: linear-gradient(to right, transparent, #fff 55%); }

局限性:
该方法能在谷歌和IE浏览器上出现文字超过就省略的效果,但是不出现…省略号!

到此这篇关于CSS 文字溢出:ellipsis在IE上不起效果的解决的文章就介绍到这了,更多相关CSS 文字溢出:ellipsis内容请搜索0133技术站以前的文章或继续浏览下面的相关文章,希望大家以后多多支持0133技术站!

以上就是CSS 文字溢出:ellipsis在IE上不起效果的解决的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » CSS 教程