省略号在 Firefox 中运行不佳,但在 Chrome 中运行良好

2023-11-30

我试图使用省略号将链接限制为宽度。

html 是这样的:

<a class="blueLink2 destination-url-space" style="top:0;" href="http://google.com/uyv245">http://google.com/iuh345345345gthrthrthrth</a>

CSS 是

.blueLink2 {
    color: #0051A1;
    display: inline;
    font-size: 14px;
    margin-left: 5px;
    overflow: hidden;
    position: relative;
    text-overflow: ellipsis;
    top: 0;
}
.destination-url-space {
    display: inline-block;
    max-width: 200px;
    overflow-x: hidden;
}

但它仅适用于 Chrome。在 Firefox 中不工作。 演示:http://jsfiddle.net/xE6HG/


你需要添加white-space: nowrap; there

DEMO

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

省略号在 Firefox 中运行不佳,但在 Chrome 中运行良好 的相关文章