gpt4 book ai didi

css - 如何在 Internet Explorer 中正确使用 CSSStyleSheet.insertRule()?

转载 作者:太空宇宙 更新时间:2023-11-04 05:46:04 26 4
gpt4 key购买 nike

我在使用此代码的 Internet Explorer 11 中遇到“IndexSizeError”错误:

var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}');

根据 https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule索引参数是可选的。

最佳答案

在 IE11 中,如果我添加索引参数,错误将得到修复:

var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}', 0);

相关:How to use CSSStyleSheet.insertRule() properly?

关于css - 如何在 Internet Explorer 中正确使用 CSSStyleSheet.insertRule()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58695205/

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