使用CSS将渐变应用于颜色属性

时间:2020-08-25 16:47:17

标签: css

我有一个带有html的社交媒体图标部分。

<li class="instagram pull-left"><a target="_blank" href="#"></a></li>

这是赋予它的样式。

.instagram a {
    font-size: 22px;
    display: inline-block!important;
    text-align: center;
    padding: 0;
    background: #359BED !important;
    color: #fff;
content: "\f16d";
    font-family: FontAwesome;
}

我想给背景白色和instagram中使用的渐变色作为颜色。如何做到这一点? 我尝试过,但是渐变即将作为background.not对于instagram icon.anybody请帮助。

1 个答案:

答案 0 :(得分:0)

尝试此操作,您可以根据需要将其应用于背景或颜色

    .instagram
        {
            #Your code
             display:inline-block;
  
  /* Create the gradient. */
  background-image: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); 
  
  background-size: 100%;

  /* Use the text as a mask for the background. */
  /* This will show the gradient as a text color rather than element bg. */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; 
  -moz-background-clip: text;
  -moz-text-fill-color: transparent;
        }