Chrome和Safari中的页面背景图片

时间:2011-03-02 10:42:34

标签: css google-chrome

我有一个HTML页面,我正在使用CSS属性应用背景图像。

问题是,我希望这个背景图像出现在相对较长页面的底部,即页面将滚动到底部以查看背景图像。

我申请了以下内容:

body {
    background: url("images/bg_homepage.png") no-repeat scroll right bottom transparent;
}

这适用于Firefox和Internet Explorer,但不适用于Chrome和Safari浏览器。 Chrome和Safari需要将background-attachment属性设置为“fixed”,但这正是我不想要的。

请指导。

由于

2 个答案:

答案 0 :(得分:0)

如果你不想要它在你的身体,你可以创建一个div和id bg例如:)

然后做这样的事情

#bg {
    background: url("/bg.gif") no-repeat scroll left bottom #FFFFFF;
    bottom: 100px;
    height: 396px;
    position: fixed;
    width: 288px;
    z-index: -1;
}

如果您不想在页面的任何位置使用固定,它将无法在主要浏览器中使用:(

答案 1 :(得分:0)

我用

完成了
body {
    width: 100%; height: 100%;
    position: absolute;
    background-image: url(img/strand_402.jpg);
}

适用于所有浏览器(包括IE)。

相关问题