在悬停状态下,如何在伪选择器中使用SASS选择器?想要编写更少的代码并进行清理。
首选方法,不起作用:
div {
a {
transition: all 0.25s ease-in-out;
&:after {
content: ">>";
left: 10px;
:hover & {
left: 10px;
}
}
}
}
相对于:
div {
a {
transition: all 0.25s ease-in-out;
&:after {
content: ">>";
left: 10px;
}
&:hover {
&:after {
left: 10px;
}
}
}
}
使用&:hover:after {}
了针对after
该元件的伪元素上空盘旋。
&:after:hover {}
将选择after
伪元素并在其上使用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句