Chrome和Safari浏览器中的线性渐变

问题描述 投票:14回答:5

我无法在Safari和Chrome中显示线性渐变。在Firefox中可以正常显示。

我正在尝试:

background: -webkit-linear-gradient(center top , #9E9E9E, #454545) repeat scroll 0 0 transparent;   
background:    -moz-linear-gradient(center top , #9E9E9E, #454545) repeat scroll 0 0 transparent;
background:     -ms-linear-gradient(center top , #9E9E9E, #454545) repeat scroll 0 0 transparent;
background:      -o-linear-gradient(center top , #9E9E9E, #454545) repeat scroll 0 0 transparent;

感谢您的帮助。

css css3 cross-browser linear-gradients
5个回答
31
投票

尝试一下-http://jsfiddle.net/fwkgM/1/

  background-color: #9e9e9e;
  background-image: linear-gradient(to bottom, #9e9e9e, #454545);

CSS3 Please


6
投票

您也可以尝试以下方法:

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

这是一个非常不错的CSS3渐变生成器。对我来说效果很好。希望它也对您有帮助! :D


5
投票

为了与跨浏览器兼容,请尝试以下操作

background-color: #9e9e9e; /* fallback color if gradients are not supported */
background-image: -webkit-linear-gradient(bottom, rgb(213,12,18), #9e9e9e 40%); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
background-image:    -moz-linear-gradient(to bottom, #9e9e9e 60%, #454545 100%); /* For Firefox (3.6 to 15) */
background-image:      -o-linear-gradient(to bottom, #9e9e9e 60%, #454545 100%); /* For old Opera (11.1 to 12.0) */ 
background-image:         linear-gradient(to bottom, #9e9e9e 60%, #454545 100%); /* Standard syntax; must be last */

1
投票
background: -webkit-linear-gradient(left,transparent,black 50%,transparent); /* worked for me*/

0
投票
background-attachment: fixed; /* worked for me */
© www.soinside.com 2019 - 2024. All rights reserved.