如果div嵌套在另一个div内,嵌套div可以忽略父项的悬停。这里有一个例子嵌套div可以忽略父项的悬停
.Box {
width: 50px;
height: 50px;
background: red;
}
.Circle {
width: 20px;
height: 20px;
background: blue;
border-radius: 20px;
}
.Box:hover {
animation: expand .5s normal forwards;
}
@keyframes expand {
0% {
transform: scale(1);
}
100% {
transform: scale(1.6);
}
}
<div class="Box">
<div class="Circle"></div>
</div>
在这个例子中会有一个方法,使箱扩张,但不是圈
'.Circle:hover {animation:none;}'? – chiliNUT