是否有一种方法可以将任何类的 &:hover
扩展到任何其他类的 hover 上?
我的代码类似于这样,它停止了两个类的 hover:
HTML
<a href="#" class="button1">Button 1</a>
<a href="#" class="button2">Button 2</a>
SCSS
.button1 {
background: black;
padding: 5px 10px;
text-decoration: none;
color: white;
&:hover {
background: red;
}
}
.button2 {
background: blue;
padding: 5px 10px;
text-decoration: none;
color: white;
&:hover {
@extend .button1:hover
}
}