嗨,我正在尝试创建一个从黑白变为彩色的悬停,但我似乎无法弄清楚为什么我不能使用第 n 个孩子和悬停。
目前我的代码看起来像这样。
<div class="ads125-wrap">
<a class="ad125" href="#"><img alt="ad125" src="syteme-design-color.png"></a>
<a class="ad125" href="#"><img alt="ad125" src="syteme-design-bw.png"></a>
</div>
.ads125-wrap {
height: 203px;
position: relative;
}
.ad125 {
margin-bottom: 0;
margin-right: 0;
position: absolute;
}
.ads125-wrap a.ad125 img{
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
.ads125-wrap a.ad125:nth-child(1) img:hover{
opacity:0;
}
谢谢