【问题标题】:Background gradient not loading on Safari & FirefoxSafari 和 Firefox 无法加载背景渐变
【发布时间】:2019-02-13 09:15:52
【问题描述】:

尝试制作背景渐变以在 Safari 和 Firefox 上运行。在 Chrome 上完美运行:

.gq_s_background_gradient:after {
    content: "";
    display: block;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-image: linear-gradient(360deg,rgba(43,135,218,0.3) 0%,#161616 85%);
    animation-duration: 2500ms;
    animation-delay: 700ms;
    opacity: 0;
    -webkit-animation-name: et_pb_fade;
    animation-name: et_pb_fade;
    -webkit-animation-fill-mode: both !important;
    animation-fill-mode: both !important;}

【问题讨论】:

  • 请提供一个工作演示/sn-p 重现您的问题。没有 HTML,无法知道 opacity: 0 或伪的 null 尺寸是否与您的问题有关

标签: css cross-browser gradient linear-gradients


【解决方案1】:

你为什么使用 opacity:0 ? 和

为所有浏览器设置背景:

background-image:

-webkit-linear-gradient(360deg,rgba(43,135,218,0.3) 0%,#161616 85%);

background-image:-moz-linear-gradient(360deg,rgba(43,135,218,0.3) 0%,#161616 85%);  

background-image:-o-linear-gradient(360deg,rgba(43,135,218,0.3) 0%,#161616 85%);

background-image:   linear-gradient(360deg,rgba(43,135,218,0.3) 0%,#161616 85%);

【讨论】:

  • 不要在所有东西上建议那些愚蠢的前缀。线性渐变甚至从来没有 -ms- 前缀。
  • 感谢提及!!它的打字错误不需要投票减号!
  • 使用这个并删除了动画部分,现在可以工作了。 Tnx
  • @MAR 我们不再需要任何渐变前缀,您可以将它们全部删除
  • 前缀? caniuse 和/或 Autoprefixer(和浏览器列表)。这里没有
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-23
  • 1970-01-01
  • 2012-09-10
  • 1970-01-01
  • 1970-01-01
  • 2023-03-19
  • 2020-08-19
相关资源
最近更新 更多