我有两个css规则集应用于表的单元格.我以为一套规则会凌驾于另一套规则之上,但它是从每一套规则中挑选一些规则.规则互相矛盾.
HTML由JavaScript生成
const toDoArray = {
test: true,
}
var toDoElements = "<table style=\"width: 100%;\">";
for (var k in toDoArray) { // Loop through the object
var trS = "";
if (toDoArray[k]) {
trS = `class="taskChecked"`
}
toDoElements +=
`<tr ${trS} id="${k}-tr">
<td onclick="checkOffToDo('${k}')" id = "${k}-td" border=none > ${k}</td>
<td onclick="removeToDo('${k}')" class="toDoDeleteButton">×</td>
</tr>`
}
toDoElements += "</table>";
document.getElementById("toDoList").innerHTML = toDoElements;
#toDoList { width: 200px; font-size: 3rem; }
.taskChecked {
text-decoration: line-through;
text-decoration-color: violet;
color: purple;
background: orange;
}
.toDoDeleteButton {
border: none;
width: 8%;
height: auto;
text-decoration: none !important;
text-decoration-color: aqua;
color: yellow;
background-color: blue;
}
<div id="toDoList"></div>
我发现这个StackOverflow Answer描述优先级(https://stackoverflow.com/a/25105841),但这似乎并不符合它. 如果它遵循所有一个,或所有其他,我以为我可以得到它的工作的权利,但现在我只是真的很困惑.
我的主要目的是不要给它一条线.其余的 colored颜色 和东西是我测试的选项试图找出发生了什么,为什么它不工作.
这是Chrome中的.