请参阅示例:http://jsfiddle.net/H5x9N/
我有一个与中心对齐的页面,宽1020像素。然后,我希望广告在其左侧和右侧包含在不会导致滚动的div中。
这是显示广告的代码的一部分:
.majorad-container {
height: 1px;
left: 50%;
margin: auto auto auto -1250px;
overflow: visible;
position: absolute;
width: 2500px;
z-index: 20;
}
.adscrollleft {
background: url("") repeat-y scroll right top #0A080B;
cursor: pointer;
float: left;
height: 120px;
margin-top: -20px;
width: 720px;
}
.adscrollright {
background: url("") repeat-y scroll left top #0A080B;
cursor: pointer;
float: right;
height: 120px;
margin-top: -20px;
width: 720px;
}
如果我使用position:fixed for .majorad-container - no x scrolling,但我希望广告向上滚动页面。
我希望能很好地解释我的问题,任何解决方案?
答案 0 :(得分:0)
制作广告的背景图片,而不是使用背景封面
#divname{
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
min-height:0%;
max-height:100%;
}