2010-06-15 21 views

回答

0

如果你想讓你的網站是與所有瀏覽器兼容,你可以使用這個:

background-image: url(someurl.gif); 
background-repeat: repeat-x; 

的someurl.gif圖像應該包含你想要的漸變。把它作爲一個非常小的圖像,你可以用repeat-x或repeat-y來擴展它。無論你喜歡什麼。

2

CSS 3 supports gradients但這不會被所有瀏覽器(例如IE6)支持。

但你可以做到這一點,我認爲這是非常類似於以前的答案:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
<style type="text/css"> 
    body { 
     padding:0px; 
     margin:0px; 
    } 
    div#bg { 
     background: url(http://www.khiba.com/PSP/FALL01/Testgrad.jpg) repeat-x; 
     height:600px; 
    } 
</style> 
</head> 

<body> 
<div id="bg"> 
</div> 
</body> 
</html>