我使用FoundationPress https://foundationpress.olefredrik.com/ 来制作一个网站。我试图通过悬停在另一个div上来切换div的显示。这里是造型::悬停效果不起作用
.test_div {
background-color:blue;
height:50px;
display:none;
}
.test_button {
width:100px;
height:50px;
background-color:blue;
cursor:pointer;
}
.test_button:hover {
background-color:green;
}
.test_button:hover .test_div {
background-color: red;
display:block;
}
这里是HTML:
<div class='test_button'>Hover to change test_div</div>
<div class='test_div'>I should be displayed</div>
它只是将无法工作。 谢谢。
孩子@DeneaNovac这是不正确的选择。您可以使用通用或直接的兄弟选择器。 – Terry