纯CSS3方法可以解决么?鼠标浮动在A上时,B和C还有D触发动画效果。
2 回答
已采纳
qq_青枣工作室_0
TA贡献446条经验 获得超754个赞
当然可以。利用 :hover 加上各种CSS选择器的定位技巧。
<!DOCTYPE html>
<style>
.A {
line-height: 40px;
}
.B, .C, .D{
-webkit-transition: 1s;
transition: 1s;
}
.B {
width: 400px;
height: 500px;
background-color: red;
}
.C{
width: 300px;
height: 200px;
background-color: green;
}
.D {
width: 300px;
height: 200px;
background-color: blue;
}
.A:hover + .B {
width: 500px;
}
.A:hover + .B>.C {
width: 100px;
}
.A:hover + .B>.D {
width: 500px;
}
</style>
<a class="A" href="#">hover me!!</a>
<div class="B">
B
<div class="C">
C
</div>
<div class="D">
D
</div>
</div>
- 2 回答
- 0 关注
- 1775 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消
