2011-08-20 74 views

回答

40

在看到你的小提琴在評論這個問題是很容易解決。您只需要添加overflow:auto或爲您的div設置特定的高度。活生生的例子:http://jsfiddle.net/tw16/xRcXL/3/

.Tab{ 
    overflow:auto; /* add this */ 
    border:solid 1px #faa62a; 
    border-bottom:none; 
    padding:7px 10px; 
    background:-moz-linear-gradient(center top , #FAD59F, #FA9907) repeat scroll 0 0 transparent; 
    background:-webkit-gradient(linear, left top, left bottom, from(#fad59f), to(#fa9907)); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907);  
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)"; 
} 
+0

是的。它的工作正常。謝謝 –

+2

這幫了我,謝謝。 – Stephen

+1

zoom:1會做同樣的事情,但對元素沒有「影響」。 (這對我來說已經解決了同樣的問題幾個小時後發誓。) – GlennG

2

你沒有指定一個GradientType

background: #f0f0f0; /* Old browsers */ 
background: -moz-linear-gradient(top, #ffffff 0%, #eeeeee 100%); /* FF3.6+ */ 
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */ 
background: -webkit-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */ 
background: -o-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* Opera11.10+ */ 
background: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* IE10+ */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0); /* IE6-9 */ 
background: linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* W3C */ 

來源:http://www.colorzilla.com/gradient-editor/

2

這應該是工作:

background: -moz-linear-gradient(center top , #fad59f, #fa9907) repeat scroll 0 0 transparent; 
/* For WebKit (Safari, Google Chrome etc) */ 
background: -webkit-gradient(linear, left top, left bottom, from(#fad59f), to(#fa9907)); 
/* For Mozilla/Gecko (Firefox etc) */ 
background: -moz-linear-gradient(top, #fad59f, #fa9907); 
/* For Internet Explorer 5.5 - 7 */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907); 
/* For Internet Explorer 8 */ 
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)"; 

否則產生使用這個並獲得代碼。

http://www.colorzilla.com/gradient-editor/

+0

仍然無法正常工作。這是我的代碼。 http://jsfiddle.net/xRcXL/2/ –

1

在測試IE7/8/9我得到了一個ActiveX警告嘗試使用此代碼段:

filter:progid:DXImageTransform.Microsoft.gradient 

刪除此警告走了之後。我知道這不是一個答案,但我認爲值得注意。