How to apply a CSS gradient over a text, from a transparent to an opaque colour

前端 未结 2 997
庸人自扰
庸人自扰 2020-12-02 10:52

Cheers!

I am a newbie in CSS/HTML, but I want to apply a gradient over a text, like that on the image below. How can I implement it with css?


 

2条回答
  •  离开以前
    2020-12-02 11:00

    CSS3 text gradients that is only supported by Webkit based browsers like Chrome and Safari. I have used 3 different methods. check this fiddle first http://jsfiddle.net/sarfarazdesigner/pvU7r/ Try this

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

    this is working fine in chrome don't know how other browser react. Reference taken from http://css-tricks.com/snippets/css/gradient-text/

提交回复
热议问题