Hello I am using following code that works fine with Firefox, but does not work in Chrome.
background: -moz-linear-gradient(center top , #CAF579, #73CA08) repeat scroll 0 0 transparent;
I used WebKit also, but still it's not working.
Hello I am using following code that works fine with Firefox, but does not work in Chrome.
background: -moz-linear-gradient(center top , #CAF579, #73CA08) repeat scroll 0 0 transparent;
I used WebKit also, but still it's not working.
Each browser has different syntax for gradient backgrounds. This code should cover the most widely used browsers:
You can see more here: http://robertnyman.com/2010/02/15/css-gradients-for-all-web-browsers-without-using-images/
Some versions (new versions) of chrome identify the standard syntax instead of
-webkit
i.eSo you should always include this with combination to
-moz
and-webkit
(for compatibility with older versions) like:check this link for more information.
For chrome you would have to use
-webkit-gradient
instead of-moz-linear-gradient
. Note that it also has a different syntax, e.g. something like this:See this page for more examples: http://webdesignerwall.com/tutorials/cross-browser-css-gradient
CSS gradients have a bit complicated syntax.
There are 5 of different syntaxes - 4 deprecated ones (old ie
filter
, newer ie-ms-filter
, old webkit-webkit-gradient
, newer mozilla-moz-linear-gradient
(plus a set of vendor prefixes to work with different browsers (-moz-
,-webkit-
,-ms-
,-o-
)) and unprefixed standardlinear-gradient
(which has major difference from previous versions in handling gradient angles).In your case, for Google Chrome you need to add
-webkit-linear-gradient
to your css. Plus, unprefixed version, because its expected, that Chrome and Safari will support standard syntax soon.Refer to MDN for details: https://developer.mozilla.org/en-US/docs/CSS/linear-gradient