【问题标题】:CSS - background-image is showing up on my machine, but not on the hosted version of my site... why?CSS - background-image 出现在我的机器上,但没有出现在我网站的托管版本上......为什么?
【发布时间】:2017-12-01 06:21:06
【问题描述】:

对于我的投资组合网站,我有一个 gif 作为背景图片。几个星期都很好,但现在它已经停止工作了。我尝试放入不同的 GIF。它在我的本地机器上看起来不错,但是当推送到我的主机时,它不再起作用。不确定它出现在我的计算机上的问题是什么,但在托管时却没有。

When it's working properly on my machine - see the triangles?

When it's not working on the actual website

该网站托管在http://www.KimberlyScarabello.com

我相当肯定我正在正确更新文件,因为其他更改显示得很好。这是我正在使用的 CSS。我已经尝试将 gif 保存到我的本地机器并将文件路径放在 url 中,但这不起作用(尽管它也适用于我的机器)。

#wrapper > .bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #212931;
        background-image: url('https://media.giphy.com/media/xTg8BbPcaAP43oVyeY/giphy.gif'), linear-gradient(0deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1));
        background-size: cover,                             auto,                                                       100% auto;
        background-position: center,                                center,                                                     top center;
        background-repeat: repeat,                              no-repeat,                                                  no-repeat;
        background-attachment: scroll,                              scroll,                                                     scroll;
        z-index: -1;
        filter: brightness(10%)
    }

【问题讨论】:

  • 我看到三角形很好。也许清除你的缓存
  • Holy titballs.. 加载网站需要整整 1 分钟。在 ADSL 10/10 gyazo.com/2a68cd5d53000323d7d68a8c570d7dad 上。但是,通过一些优化,该站点看起来很棒!但是,是的,它是缓存。

标签: html css background-image hosting


【解决方案1】:

它对我来说很好用。

这很可能是由您的缓存引起的。每当您遇到此类问题时,只需使用 ctr+f5 重新加载您的网站(我认为是 cmd+shift+r for mac?)。如果这对你不起作用,请告诉我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-25
    • 2021-12-25
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多