您将如何编写它以符合 SASS 标准?
.fader { display: inline-block; }
.fader img:last-child {
position: absolute;
top: 0;
left: 0;
display: none;
}
基本上我只是在复制这个在一个图像上淡入另一个图像的例子(在这里找到。)
他的 JFiddle 示例:http: //jsfiddle.net/Xm2Be/3/
但是他的例子是纯 CSS,我正在 SASS 中开发一个项目,但不确定如何正确翻译它。
我的代码
请注意,在下面的示例中,img 悬停无法正常工作(两个图像都显示并且没有发生翻转淡入动作)
我的 CodePen: http ://codepen.io/leongaban/pen/xnjso
我试过了
.try-me img:last-child & .tryme img:last-of-type
但是 : 抛出 SASS 编译错误,下面的代码有效
.try-me img last-of-type {
position: absolute;
top: 0;
left: 0;
display: none;
}
但是它吐出对我没有帮助的CSS:
.container .home-content .try-me img last-of-type {
position: absolute;
top: 0;
left: 0;
display: none;
}