有没有办法在滚动页面时让天空/湖泊的背景保持静止?
网站
CSS中:
background-attachment: fixed
http://www.w3schools.com/css/tryit.asp?filename=trycss_background-attachment
或者简写为:
body {background: url("/images/myimage.png") no-repeat fixed top left;}
body{
background-image:url('lake.jpg'); /* or whatever */
background-attachment:fixed;
}
尝试
background-attachment:fixed;
<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>
那应该可以完成工作。