背景图像的水平滚动

时间:2012-07-24 21:52:02

标签: css

我有一个div,里面有多个元素,它们比父div的宽度更远。我设置overflow-x滚动,背景附件滚动,但是当我左右滚动时,背景图像保持固定

以下是该页面的链接:http://okcomputerstl.com/K9_Athletic_Club/services.html 砖背景是我想要滚动的

这是css

.framecontain {
    width: 979px;
    height: 490px;
    position: relative;
    overflow-x: scroll;
    background-image: url(../graphics/services/brickbg.png);
}

.services .textbox {
    position: absolute;
    top: 52px;
    width: 395px;
    height: 358px;
    z-index: 2;
    background-image: url(../graphics/services/frame.png);
}

.services .one {
    left: 64px;
}

.services .two {
    left: 508px;
}

.services .three {
    left: 953px;
}

.services .four {
    left: 1388px;
}

.services .five {
    left: 1826px;
}

1 个答案:

答案 0 :(得分:0)

我认为你必须将你的砖墙容器包装在另一个div中才能实现这一点。

<div id="container">  <!-- div having the scrollbar-->
  <div id="bricks"></div> <!-- div having the background-->
</div>