嘿,我正在爲我的網站的新背景工作。我正在嘗試使它更多一點。我目前在這裏工作:http://wow-x.com/back/動畫背景不是固定的
正如你所看到的,當你向下滾動頁面時,稱爲「背景」的div不會保持「固定」......我似乎無法使它保持固定。
我的CSS是這樣的:
body {
background-color: #0a0a0a;
color: #a2a2a2;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 1.4;
margin: 0;
padding: 0;
background-image: url(http://wow-x.com/board/images/blackevo4-pure/background.jpg);
background-repeat: no-repeat;
background-position: center top;
background-attachment:fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#background {
background: url(http://wow-x.com/board/images/blackevo4-pure/back1.jpg);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
opacity:0.1;
z-index:-1;
}
#midground {
background: url(http://wow-x.com/board/images/blackevo4-pure/midground.png) repeat 20% 20%;
background-attachment:fixed;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index:-2;
height:100%;
width:100%;
}
#foreground {
background: url(http://wow-x.com/board/images/blackevo4-pure/foreground.png) repeat 90% 110%;
background-attachment:fixed;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index:-3;
height:100%;
width:100%;
}
如果你想保持'#DIV background'固定,改變它的從'位置的位置是:絕對的;''來位置:固定;' – godfrzero
它工作!謝謝! –