Gradient colour with Linear Gradient Border in text using css not working

前端 未结 2 1689
灰色年华
灰色年华 2021-01-13 18:50

I would like design £1 similar to the following image using CSS.

I would like to have some text with gradient colour, gradient border and t

2条回答
  •  野的像风
    2021-01-13 19:26

    I think the only way to have this effect is to duplicate the text. One will get the stroke coloration and the other the background coloration:

    I used different colors to better identify them:

    span[data-text] {
      display:inline-block;
      font-size:90px;
      font-weight:bold;
      font-family:arial;
      position:relative;
      margin:10px;
    }
    span[data-text]:before {
      content:attr(data-text);
      text-shadow: 0 2px 20px purple;
      background: linear-gradient(to bottom,red 0%, blue 100%);
      -webkit-text-stroke: 5px transparent;    
      -webkit-background-clip: text;
      background-clip: text;
      color:transparent;
    }
    span[data-text]:after {
      content:attr(data-text);
      left:0;
      top:0;
      position:absolute;
      background-image: linear-gradient(275deg, green 0%, yellow 100%);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

提交回复
热议问题