2017-07-17 74 views
0

如何將以下CSS轉換爲SCSS?使用scss在父類上懸停僞元素

.parent-class:hover .child-class { 
    visibility: visible; 
    animation-name: bounceIn; 
    animation-duration: 450ms; 
    animation-timing-function: linear; 
    animation-fill-mode: forwards; 
    transition-delay:0s; 
} 

下面的代碼似乎並沒有工作:

.parent-class{ 
    &:hover .childclass{ 
    visibility: visible; 
    animation-name: bounceIn; 
    animation-duration: 450ms; 
    animation-timing-function: linear; 
    animation-fill-mode: forwards; 
    transition-delay:0s; 
    } 
} 

回答

1

你SCSS具有正確的想法 - 除非你已經在你的類名稱的拼寫錯誤:

.childclass - >.child-class

.parent-class{ 
    &:hover .child-class{ 
    visibility: visible; 
    animation-name: bounceIn; 
    animation-duration: 450ms; 
    animation-timing-function: linear; 
    animation-fill-mode: forwards; 
    transition-delay:0s; 
    } 
} 
+1

哎呦......對不起!我瘋了尋找解決方案... –

0

丹菲爾德是正確的,只是爲了使它更簡潔:

.parent-class { 
    &:hover .child-class { 
    visibility: visible; 
    animation: bounceIn 450ms linear forwards; 
    transition-delay: 0s; 
    } 
}