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



我在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;

谢谢你的帮助。

试试这个-http://jsfiddle.net/fwkgM/1/

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

CSS3请

您也可以尝试以下操作:

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

这是一个非常好的CSS3梯度生成器。它对我很有效。希望它也能帮助你!:D

为了实现跨浏览器兼容性,请尝试以下

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 */
background: -webkit-linear-gradient(left,transparent,black 50%,transparent); /* worked for me*/
background-attachment: fixed; /* worked for me */

对我来说,safari不喜欢从颜色变成transparent,所以唯一的解决方案是从透明颜色变成相同颜色的零不透明度版本。

错误的

background: linear-gradient(to bottom, rgba(255, 255, 255, .75), transparent);

良好

background: linear-gradient(to bottom, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0));

最新更新