最近项目中UI 设计了图标渐变效果,在此处记录下:

  html部分代码:

 <view class="icon iconfont iconyuezhifu_icon item-icon"></view>

css:

 .item-icon{
            // color: #e54746;
            font-size: 52rpx;
            background-image: linear-gradient(135deg, 
            #eb6867 0%, 
            #e85857 67%, 
            #e54746 100%);
            -webkit-background-clip: text;
            color:transparent;
  }

 除了设置 -webkit-background-clip :text; 

实现渐变字体,还需要将color 设置为transparent 来配合一起使用

相关文章:

  • 2021-08-29
  • 2021-11-11
  • 2021-10-19
  • 2021-11-05
  • 2021-12-03
  • 2021-12-15
  • 2021-12-15
猜你喜欢
  • 2021-05-06
  • 2021-07-21
  • 2021-12-22
  • 2021-11-01
  • 2021-12-05
  • 2021-12-15
  • 2021-12-15
相关资源
相似解决方案