2011-02-11 26 views

回答

1

只需從200px刪除px 。在Webkit的漸變語法中,像素值是無單位的。即

background: -webkit-gradient(linear, 0 0, 0 200, from(blue), to(red)); 

見的Surfin' Safari的博客的Introducing CSS Gradients

點是一對空間分割的值。語法支持數字,百分比或關鍵字頂部,底部,左側和右側的點值。

編號不具有單元,相對於長度,這做,according to the CSS specification

1

試試這個:

-webkit-gradient(
    linear, 
    left bottom, 
    left top, 
    color-stop(0.3, rgb(255,0,0)), 
    color-stop(0.47, rgb(255,0,0)), 
    color-stop(1, rgb(0,0,254)) 
); 

更多信息-webkit-gradient,請訪問:http://webkit.org/blog/175/introducing-css-gradients/

活生生的例子:http://jsfiddle.net/aruUS/3/

工具來幫助您更:http://gradients.glrzad.com/

+0

謝謝,但仍然使用「相對」值。這不 - > http://jsfiddle.net/aruUS/6/ – 2011-02-11 13:31:31