【问题标题】:applying gradient to color property using css [duplicate]使用css将渐变应用于颜色属性[重复]
【发布时间】:2020-12-14 10:07:11
【问题描述】:

我有一个带有 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 中使用的渐变颜色。如何做到这一点? 我试过了,但渐变是作为背景来的。不是 Instagram 图标。请大家帮忙。

【问题讨论】:

  • 可以和我们分享一下html代码吗?你用的是什么库?
  • 共享的html代码

标签: css


【解决方案1】:

试试这个,你可以根据需要将它应用到背景或颜色上

    .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;
        }

【讨论】:

  • 我想将白色作为背景色,并且必须应用内容渐变。 标签必须获得白色背景和颜色渐变。
  • 你能用我的代码分享一个 js fiddle 这是如何工作的
  • 好的,你应该将这些属性添加到链接中:display:inline-block;背景图像:线性渐变(45度,#f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); -webkit-background-clip:文本; -webkit-text-fill-color:透明; -moz-背景剪辑:文本; -moz-text-fill-color: 透明;
猜你喜欢
  • 1970-01-01
  • 2021-04-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多