gpt4 book ai didi

html - Firefox 浏览器中的多行文本省略号

转载 作者:行者123 更新时间:2023-11-27 23:20:11 25 4
gpt4 key购买 nike

我找到了如何使用 css3 制作多行文本省略号。

这是我找到的链接。 http://codepen.io/martinwolf/pen/qlFdp

在chrome浏览器中是正确的,在firefox浏览器中是错误的。

如何使用css3Firefox浏览器中制作多行文本省略号

重要这个问题是如何使用 only css3 处理 Firefox 中的多行文本...

最佳答案

我将分享我的发现: http://revelry.co/multi-line-ellipsis-using-pure-css/

但它有点问题,必须定义背景颜色。透明没有帮助。在 :before 中我可以使用透明,但是 :after 必须定义准确的颜色。

所以,我最终的 CSS 是:

.text-truncate {
display: block; /* Fallback for non-webkit */
display: -webkit-box;
max-width: 280px;
max-height: 72px;
margin: 0 auto;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis; /* required for Opera */
-ms-text-overflow: ellipsis; /* required for IE8, allegedly */
/* Firefox solution: */
@-moz-document url-prefix() {
overflow: hidden;
position: relative;
&:before {
background: transparent;
bottom: 0;
position: absolute;
right: 0;
float: right;
content: '\2026';
margin-left: -3rem;
width: 3rem;
}
&:after {
content: '';
background: #fcfcfc;
position: absolute;
height: 50px;
width: 100%;
z-index: 1;
}
}

关于html - Firefox 浏览器中的多行文本省略号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41512407/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com