gpt4 book ai didi

javascript - 如何检查文本溢出:ellipsis is supported in browser

转载 作者:行者123 更新时间:2023-11-30 10:39:21 24 4
gpt4 key购买 nike

我想检查对省略号溢出的支持,而不是通过查询浏览器类型或版本。这可能吗?

我知道 firefox 版本 < 7 不支持这个。

谢谢,塔尔

最佳答案

没有尝试过这种方法,但这可能有效:

function checkEllipsis() {
var d = document.createElement('div');
if(typeof d.style.textOverflow == 'undefined')
return false;
d.style.textOverflow = 'ellipsis';
return d.style.textOverflow == 'ellipsis';
}

关于javascript - 如何检查文本溢出:ellipsis is supported in browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12026675/

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