textDecoration:当我尝试使用js 更改cssText时,没有人不想对其进行处理
document.querySelectorAll("nav > *").forEach(function (e) {
e.style.cssText = " textDecoration:none ;color: #000";
});
CSS属性使用破折号来分隔像这样的单词:text-decoration
。在JavaScript中,这些相同的属性在camelCase中被引用。
https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration
有两种解决方案:
或者使用虚线属性名称,在CSS:中是正确的
e.style.cssText = "text-decoration: none; color: #000;";
或引用JavaScript:中的属性
e.style.textDecoration = "none";
e.style.color = "#000";