在铬和Safari浏览器的线性梯度(Linear gradient in Chrome and Sa

2019-06-26 13:45发布

我有表示Safari和铬的线性梯度的麻烦。 在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;

感谢您的帮助。

Answer 1:

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

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

CSS3请



Answer 2:

你也可以试试这个:

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

这是一个相当不错的CSS3渐变发电机。 它为我工作很好。 希望它可以帮助你! :d



Answer 3:

对于跨浏览器兼容请尝试以下操作

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 */


Answer 4:

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


文章来源: Linear gradient in Chrome and Safari browsers