css - 需要 chrome 加载图像的解决方案

标签 css google-chrome web

我有一个图像设置为 div 的背景。它在 IE10 中加载正常,但为什么它在 chrome 中只加载了一半?刷新页面后它会完全加载。

这是我的 CSS 代码。我不确定它是否经过完美优化,但它适用于 IE10。唯一的问题是背景没有加载 chrome。

html, body {
    background-color:black;
    height:100%;
    width:100%;
    margin:0;
    padding:0;
    text-align:center;
    color:white;
    font-family:"Century Gothic",Times new roman, Georgia, Serif;
}
#container {
    min-height:100%;
    height:auto;
    height:100%;
}
#img {
    margin:0 auto;
    width:800px;
    height:700px;
    background-image:url("../images/comingsoon.jpg");
    background-repeat:no-repeat;
    background-attachment:fixed;
    background-position:center;
    padding-bottom:50px;
}
#text {
    padding-bottom:100px;
}
#footer {
    position:relative;
    bottom:0;
    width:99%;
    padding-bottom:1px;
}
.link a:hover, a:visited, a:link, a:active{
    text-decoration:none;
    color:white;
}
img {
    border:0;
}

最佳答案

这就是 fiddle ,我第一次使用它希望没问题 http://jsfiddle.net/tH2bL/1/ 在这里输入代码

但是如果没有图片你实际上看不出我的问题是什么,你可以在 www.speakeasy-events.com 上用 chrome 查看它

css div img 的 jpg 链接在谷歌浏览器上加载了一半,但在 IE10 上加载了一半,我需要刷新它才能看到完整图片。

另一件事我不确定我的代码是否真的优化过,我想我可能需要很多 div 来做我想做的事,或者我应该把 div #text 放在相对于 #img 的位置,这样它就可以保留同一个地方

对于另一个问题,您可以看到,当浏览器窗口较小并且您使用滚动条时,div 文本会覆盖 img 并将其屏蔽,您如何避免这种情况?

关于css - 需要 chrome 加载图像的解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18904207/

相关文章:

表格中是否包含 HTML 表单

html - 支持键盘导航的自定义 HTML 复选框符号?

html - input ['file' ] accept ="image/*"打开对话框用 Chrome 这么慢

php - 使用 PHP 的 HTML 到 PDF 转换器

html - 如何使用CSS创建横向div?

html - Chrome 不应该重新计算元素宽度

google-chrome - 如何在 Chrome 中保存 websocket 帧

PHP/MySQL 性能

javascript - 将应用程序连接到 AWS 上的 RethinkDB 服务器

javascript - 较长名称的 JSTREE 链接/节点在 Chrome 中未正确呈现