考虑一下这个:http://jsfiddle.net/yP7Nf
示例代码:
<div class="first"><img src="http://placekitten.com/g/200/300"/></div>
<div class="second"></div>
<div class="third"></div>
.first {
background-color: #a6a6a6;
height: 600px;
background-attachment: fixed;
background-image: url("http://placehold.it/1000x500");
}
.second {
background-color: #fff;
min-height: 500px;
}
.third {
background-color: #ff0000;
min-height: 500px;
background-attachment: fixed;
}我希望猫的图片保持粘性,这样第二个div ('.second')就可以像覆盖背景一样覆盖它。
我想模拟与背景附件相同的行为:修复猫的图片。
帮助。
发布于 2013-04-19 17:36:31
在您的图像上,使用position : fixed阻止滚动,使用z-index:-1使其隐藏在事物的后面
如果它位于你不想要的东西后面,对它使用z-index:-2
https://stackoverflow.com/questions/16101240
复制相似问题