我需要实现这一点:当我将鼠标悬停在红色框上时,紫色的应该会消失,当我将鼠标悬停在橙色的框上时,蓝色的应该会消失,然后我将鼠标悬停在黄色的框上,绿色的会消失。我设法做到了,但我也需要反过来做,但我尝试的一切都没有奏效。有人可以帮我吗?
<html>
<head>
<title>Boxes</title>
<style type"text/css">
div {
width:70px;
height:90px;
border:3px solid #000;
}
.t1 {
background: red;
top: 50px;
left: 15px;
position: absolute;
}
.t1:hover + .t6{
background: red;
top: 50px;
left: 15px;
z-index: 1;
position: absolute;
visibility: invisible;
}
.t2 {
position: absolute;
background:orange;
top: 100px;
left: 60px;
}
.t2:hover + .t5 {
position: absolute;
background:orange;
top: 100px;
left: 60px;
z-index: 1;
visibility: invisible;
}
.t3 {
background:yellow;
top: 150px;
left: 110px;
position: absolute;
}
.t3:hover + .t4 {
background:yellow;
top: 150px;
left: 110px;
position: absolute;
visibility: invisible;
z-index: 1;
}
.t4 {
background:green;
top: 200px;
left: 160px;
position: absolute;
}
.t5 {
background:blue;
top: 250px;
left: 210px;
position: absolute;
z-index: 1;
}
.t6 {
background:purple;
top: 300px;
left: 260px;
position: absolute;
z-index: 2;
}
<!--backwards-->
</style>
</head>
<body>
<div class="t1"></div>
<div class="t6"></div>
<div class="t2"></div>
<div class="t5"></div>
<div class="t3"></div>
<div class="t4"></div>
</body>