2013-03-26 44 views
1

所以我開始使用LESS CSS。現在我有一個不透明的父div:0.8; 我希望孩子有不透明度:1;少css不透明的孩子

所以我創造了這個:

.offerte{ 
    font-family: BrushScriptRegular; 
    font-size: 34px; 
    background-color: black; 
    opacity: 0.80; 

    a:hover { 
    border-bottom: @underlineBorder; 
    opacity: 1; 
    } 
} 

我被告知,這應該覆蓋的父母不透明度更低。但這對我不起作用。任何其他解決方案與LESS如何處理?

thx提前!

+1

http://stackoverflow.com/questions/12613191/why-cant-child-elements-override-the-opacity-of-parent-with-a-greater-value TLDR:use'rgba'用於顏色和背景顏色而不是不透明度。 – steveax 2013-03-26 06:09:37

+0

@steveax我知道這是正常CSS的最佳方式。但我真的認爲這是可能的與LESS – Kevinvhengst 2013-03-26 06:14:18

+3

不。最終,LESS將向瀏覽器提供CSS,而不是那裏的魔法。 – steveax 2013-03-26 06:15:31

回答

1

他們對你的代碼中的一些重大變化,看看,

.offerte { 
    font-family: BrushScriptRegular; 
    font-size: 34px; 
    background-color: black; 
    opacity: 0.8; 
    &:hover { 
    border-bottom: @underlineBorder; 
    opacity: 1; 
    } 
} 

我支持offerte是一類盤旋下來,如果是,那麼你應該做這些修改的錨...謝謝...