使背景固定(静止不动)

4
有没有办法在滚动页面时让天空/湖泊的背景保持静止? 网站
5个回答


3

或者简写为:

body {background: url("/images/myimage.png") no-repeat fixed top left;}

1
body{
    background-image:url('lake.jpg'); /* or whatever */
    background-attachment:fixed;
}

1

尝试

background-attachment:fixed;

0
在那个网站上,更改这一行。
<div><img src="images/bottom_bg.jpg" width="100%" alt="" /></div>

<div id="foobar"><img src="images/bottom_bg.jpg" width="100%" alt="" /></div>

并添加以下CSS:

<style>
#foobar{ position: fixed; bottom: 0px; width: 100%; }
</style>

那应该可以完成工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接