Linear gradient in Chrome and Safari browsers

こ雲淡風輕ζ 提交于 2019-11-29 02:33:07

问题


I am having trouble showing a linear gradient in Safari and Chrome. In Firefox it shows up fine.

I am trying:

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;

Thanks you for your help.


回答1:


Try this - http://jsfiddle.net/fwkgM/1/

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

CSS3 Please




回答2:


You can also try this:

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

It's a pretty good CSS3 gradient generator. It has worked well for me. Hope it helps you too! :D




回答3:


For Cross browser compatibility try the following

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



回答4:


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



回答5:


background-attachment: fixed; /* worked for me */


来源:https://stackoverflow.com/questions/11693580/linear-gradient-in-chrome-and-safari-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!