Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将样式添加到悬停-scss上的多个元素_Css_Sass - Fatal编程技术网

将样式添加到悬停-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;
        }
    }
}