javascript - 如何在不影响可见性的情况下为 Instagram Logo 添加颜色渐变?

标签 javascript html css gradient

我想在不影响 Logo 可见性的情况下向 Instagram Logo 添加颜色渐变。

HTML

<div class="wrapper">
      <a href="http://www.facebook.com"><i class="fa fa-3x fa-facebook-square"></i></a>
      <a href="http://www.twitter.com"><i class="fa fa-3x fa-twitter-square"></i></a>
      <a href="http://www.instagram.com"><i class="fa fa-3x fa-instagram instagram"></i></a>
</div>

CSS

.wrapper {
  justify-content: center;
  align-items: center;
}
.wrapper i {
  padding: 10px;
  text-shadow: 0px 6px 8px rgba(0, 0, 0, 0.6);
  transition: all ease-in-out 150ms;
}
.wrapper a:nth-child(1) {
  color: #3b5998
}
.wrapper a:nth-child(2) {
  color: #1DA1F2;
}
.wrapper a:nth-child(3) {
  color: black;
}
.wrapper i:hover {
  margin-top: -3px;
  text-shadow: 0px 14px 10px rgba(0, 0, 0, 0.4);
}

我正在创建一个网站,其中的社交媒体图标在悬停时会响应,并且 Logo 有一个图标。

最佳答案

使用径向渐变background-clip

致谢 https://stackoverflow.com/a/49659118/8053274

.wrapper {
  justify-content: center;
  align-items: center;
}

.wrapper i {
  padding: 10px;
  text-shadow: 0px 6px 8px rgba(0, 0, 0, 0.6);
  transition: all ease-in-out 150ms;
}

.wrapper a:nth-child(1) {
  color: #3b5998
}

.wrapper a:nth-child(2) {
  color: #1DA1F2;
}

.wrapper a:nth-child(3) {
  color: black;
}

.wrapper i:hover {
  margin-top: -3px;
  text-shadow: 0px 14px 10px rgba(0, 0, 0, 0.4);
}

.fa-instagram {
  color: transparent;
  background: -webkit-radial-gradient(30% 107%, circle, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  background: -o-radial-gradient(30% 107%, circle, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  background: -webkit-radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  background-clip: text;
  -webkit-background-clip: text;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />

<div class="wrapper">
  <a href="http://www.facebook.com"><i class="fa fa-3x fa-facebook-square"></i></a>
  <a href="http://www.twitter.com"><i class="fa fa-3x fa-twitter-square"></i></a>
  <a href="http://www.instagram.com"><i class="fa fa-3x fa-instagram instagram"></i></a>
</div>

关于javascript - 如何在不影响可见性的情况下为 Instagram Logo 添加颜色渐变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56574105/

相关文章:

javascript - 如何在 CKEDITOR 中使下标/上标互斥?

javascript - 使用 Jquery 抓取 url

javascript - 长单行 ES6 字符串文字

html - Bootstrap 列在不应该调整大小为单行时

javascript - 可调整大小的 jQuery 在 Angular JS 中不起作用

html5 视频 : fastest fast forward and slowest slow motion?

html - 固定位置的网站菜单在 Internet Explorer 9 中不显示

javascript - 为什么 getBoundingClientRect 只能在本地工作?

css - IE 在使用透明度过滤器时不显示负边距

html - 如何在 div 悬停时设置 H2 标签的颜色?