相关疑难解决方法(0)

CSS:滚动时背景图像不会填充

在一个非常小的网站上工作,一次加载,所以有一个div保存所有的背景图像,并在其上(即更高的z索引)有一个内容div保存一切.我可以根据选择的内容轻松切换背景.

不幸的是,我注意到如果你在一个小窗口中启动以便滚动条出现,如果滚动,页面的"显示"部分中没有背景图像.:-(

页面结构:

<body>
<div id="bg">
    <div class="bgone"></div>
    <div class="bgtwo"></div>
</div>

<div id="container">
<!-- content panels here -->
</div>
</body>
Run Code Online (Sandbox Code Playgroud)

CSS:

#bg
{
    margin: 0px;
    position: absolute;
    top: 0px;
    left: 0px;
    width:100%;
    height: 1024px;
    z-index:1;
}
.bgone
{
    margin: 0px;
    position: absolute;
    width:100%;
    height: 1024px;
    background-image:url(../images/one.jpg);
    background-position:top;
    background-repeat:repeat-x;
    z-index:2;
}
.bgtwo
{
    margin: 0px;
    position: absolute;
    width:100%;
    height: 1024px;
    background-image:url(../images/two.jpg);
    background-position:top;
    background-repeat:repeat-x;
    z-index:3;
}
#container
{
    position:relative;
    width:900px;
    padding:0px;
    margin:0px auto;
    height:600px;
    z-index:10;
}
Run Code Online (Sandbox Code Playgroud)

css scroll background-image

26
推荐指数
4
解决办法
4万
查看次数

标签 统计

background-image ×1

css ×1

scroll ×1