CSS: Gradient text colour?

前端 未结 1 743
误落风尘
误落风尘 2021-01-19 11:09

I\'m trying to get some text to have a gradient colour, but I haven\'t a clue how. I\'m trying to get it like this:

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-19 11:21

    For webkit based browsers (Chrome & Safari) :

    .text {
      font-size: 20px;
      background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#111));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    

    For IE & others:

    http://www.webdesignerwall.com/demo/css-gradient-text/

    0 讨论(0)
提交回复
热议问题