美文网首页
给文字icon加上渐变效果

给文字icon加上渐变效果

作者: 磨人的磨磨虫 | 来源:发表于2018-08-30 20:08 被阅读10次

主要思路是写一个伪类定位给他设置遮罩层 (-webkit-mask-image);我这里写的小程序

这是效果

代码如下:

content是你引入的icon 字体

 .iconfont{

  font-size: 180rpx;

  position: relative;

  margin-bottom: 34rpx;

  display: inline-block;

}

 .iconfont::after { 

    content: "\e603"; 

    color: #FD764D; 

    position: absolute; 

    left: 0; 

    z-index: 2;

    top: 0;

    -webkit-mask-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#F4494B), to(rgba(253, 118, 77, 0.8)));

}

相关文章

网友评论

      本文标题:给文字icon加上渐变效果

      本文链接:https://www.haomeiwen.com/subject/uvgdwftx.html