将样式添加到悬停-scss上的多个元素
我目前有一段代码,当页脚单元格悬停在上方时,页脚标题和副标题将变为白色,它可以工作:将样式添加到悬停-scss上的多个元素,css,sass,Css,Sass,我目前有一段代码,当页脚单元格悬停在上方时,页脚标题和副标题将变为白色,它可以工作: .footer-cell { position: relative; display: table; height: 160px; &:hover .footer-title { // footer-title line color: white; } &:hover .footer-subtitle { // footer
.footer-cell {
position: relative;
display: table;
height: 160px;
&:hover .footer-title { // footer-title line
color: white;
}
&:hover .footer-subtitle { // footer-subtitle line
color: white;
}
}
是否有任何方法,我可以结合页脚标题行和页脚字幕行,这样我就没有重复的代码?我试过这个,但不起作用:
.footer-cell {
position: relative;
display: table;
height: 160px;
&:hover .footer-title, .footer-subtitle {
color: white;
}
}
只需将选择器包装在
:hover
类中:
.footer-cell {
position: relative;
display: table;
height: 160px;
&:hover{
.footer-title, .footer-subtitle {
color: white;
}
}
}
只需将选择器包装在
:hover
类中:
.footer-cell {
position: relative;
display: table;
height: 160px;
&:hover{
.footer-title, .footer-subtitle {
color: white;
}
}
}