2016-10-26 33 views
0

目前,我有這個代碼時頁腳小區上空盤旋,果然頁腳標題和副標題白色的,它的工作原理:添加樣式多種元素上懸停 - SCSS

.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; 
    } 
} 

回答

2

只是包裝的選擇在:hover類:

.footer-cell { 
    position: relative; 
    display: table; 
    height: 160px; 

    &:hover{ 
     .footer-title, .footer-subtitle { 
      color: white; 
     } 
    } 
} 

Compiles to this

相關問題