是否可以
在 CSS3 中更新输入[类型=复选框]:选中状态后的第一个子项,而不涉及 jQuery?
我的问题是关于我的演示中的这种技术:
input[type=checkbox]:checked ~ .useraccounts,
input[type=checkbox]:checked ~ .hashtags {
background-color: #fd2626; // red color
}
尝试使用相邻的同级选择器:
input[type=checkbox]:checked + * {
color: #fd2626;
}
它将选择紧跟在input
元素之后的任何元素。