在此示例中,'〜'的含義是什麼?我從本教程中看到了這個例子。 http://css-tricks.com/the-checkbox-hack/取決於輸入複選框狀態的CSS3樣式元素
我知道可以根據複選框的狀態完全不同地使用元素的樣式。但是,我找不到任何解釋'〜'的CSS文檔?
input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
/* For mobile, it's typically better to position checkbox on top of clickable
area and turn opacity to 0 instead. */
}
/* Default State */
div {
background: green;
width: 400px;
height: 100px;
line-height: 100px;
color: white;
text-align: center;
}
/* Toggled State */
input[type=checkbox]:checked ~ div {
background: red;
}