Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross browser CSS 3 text gradient [duplicate]

Tags:

html

css

On my website, I'm using a text gradient for the heading, but it only works on Chrome and probably Safari (although I haven't tested it), below is the code I'm using for the gradient. I was wondering whether there was a way to achieve the same/similar effect that would work across all 3 browsers?

      background: -webkit-linear-gradient(#eee, #333);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

EDIT: The problem with the other solution that's been posted is that it only works on a white background, as someone said in the comments, which is no good for me as I'm using a grey background.

like image 422
Harry12345 Avatar asked Aug 23 '13 12:08

Harry12345


2 Answers

If you want this to work in non-WebKit browsers, you need to use a solution other than CSS.

There are some JavaScript solutions out there, or you can use SVG.

Here's a good blog post on how to do it: http://lea.verou.me/2012/05/text-masking-the-standards-way/

Using JavaScript has the downside of... using JavaScript, but at the end of the day this is only a decorative visual effect.

like image 130
thirtydot Avatar answered Oct 31 '22 13:10

thirtydot


-moz-background-clip:text does not work on firefox, and you won’t be able to achieve clipping effect in Firefox.

You can use cufon for the text gradients, and thay will work on IE, Chrome and Firefox

like image 44
psd2htmldepot Avatar answered Oct 31 '22 13:10

psd2htmldepot