2

我有一個複選框和一個樣式標籤,具體取決於複選框是否被選中。到目前爲止,我使用[selectivizr]腳本1來管理在IE7中工作的:selected屬性。但不知何故,漸變不能在IE 7,8和9中使用propper。應該有一個漸變從淺到深的綠色,但我會得到深藍色漸變。我無法解釋這種奇怪的行爲,也許它與css-rules的順序有關?IE 7中的線性漸變背景 - 9

 input[type=checkbox]:checked + label { 
     background: #00bf00; 
     background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%); 
     background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%); 
     background: -o-linear-gradient(top, #00bf00 0%, #009400 100%); 
     background: -ms-linear-gradient(top, #00bf00 0%, #009400 100%); 
     background: linear-gradient(top, #00bf00 0%, #009400 100%); 
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#222', endColorstr='#45484d',GradientType=0); /* EDIT: UPDATE BELOW:*/ 
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00bf00', endColorstr='#009400',GradientType=0); 
    } 

回答

5

你的十六進制值是錯誤的IE6-9部分:

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00bf00', endColorstr='#009400',GradientType=0); /* IE6-9 */ 
+1

感謝這解決了我的錯誤的部分,另一個連接到它。很明顯,這個IE篩選器狗屎不能像#222那樣處理十六進制值,我將它改爲#222222,現在它像一個魅力 – abimelex 2013-05-02 10:51:21