【问题标题】:Bootstrap background image not show using firefox使用 Firefox 不显示引导背景图像
【发布时间】:2016-03-01 01:41:24
【问题描述】:

在我正在使用的 html 文件中:

<body style="background-image:url(images/back.png); ">
....
</body>

在我的 css 文件中:

body {

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
  color:#fff;
    background-color:#333;
    font-family: 'Open Sans',Arial,Helvetica,Sans-Serif;
}

当我在谷歌浏览器上打开网页时,它工作正常,但在 Firefox 上,图像不会出现。如果我从 Css 文件而不是从 html 文件调用图像,也会发生同样的事情。

我得到了更多信息,当我在 Firefox 中使用我们的控制台时,我收到了这个错误:

Image corrupt or truncated.

【问题讨论】:

  • 你的代码已经为我工作了
  • 我刚刚在我的 Firefox 浏览器中尝试了您的代码,它似乎工作正常。 (Windows 7 64 位,Firefox 41.0.2)。
  • 您使用的是托管在网络上还是您的电脑上的图片?
  • 它只适用于在线图片
  • 我正在使用在线页面和图像进行测试。你有你的在线我们可以查看和测试的地方吗?

标签: html css twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

尝试将以下内容添加到您的 body CSS 标记中。

background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;

【讨论】:

【解决方案2】:

我发现了这个:https://bugzilla.mozilla.org/show_bug.cgi?id=941823

基本上大图像可能会在 Firefox 上导致“图像损坏或截断”错误,所以我将图像缩小到 7494x3891 的大小,它工作得很好。

【讨论】:

    【解决方案3】:

    可能是您的图像是当前文件。 我尝试使用您的代码替换一张在线图片,它也可以在 chrome 和 firefox 中使用。 检查示例[https://jsfiddle.net/wdhzujqn/]1

    【讨论】:

    • 我发布了解决方案,图片是大jaja firefox有一个错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-18
    • 2018-06-29
    相关资源
    最近更新 更多