选中复选框状态无法更新输入 CSS3 以上的样式范围


是否可以

在 CSS3 中更新输入[类型=复选框]:选中状态后的第一个子项,而不涉及 jQuery?

我的

问题是关于我的演示中的这种技术:

input[type=checkbox]:checked ~ .useraccounts,
input[type=checkbox]:checked ~ .hashtags {
    background-color: #fd2626; // red color
}

尝试使用相邻的同级选择器:

input[type=checkbox]:checked + * {
    color: #fd2626;
}

它将选择紧跟在input元素之后的任何元素。

最新更新