日期:2014-05-17  浏览次数:20722 次

背景浮动于所有层上方
如何像这样网站 那个飞机能在左右层上方http://www.etonkids.com/

<style type="text/css">
<!--

#aad {
background-image: url(http://www.etonkids.com/Portals/_default/Skins/DarkKnight/images/bg-plane.png);
background-attachment: fixed;
background-repeat: no-repeat;
background-position-x: 50%;
background-position-y: 0px;
background-size: aut0;
background-origin: padding-box;
background-clip: border-box;
background-color: transparent;
visibility: visible;
position: static;
display: inherit;
width: 100%;
}
#aad .aas {
width: 100%;
height: 300px;
background-color: #FF0000;
}
-->
</style>
<div id="aad">
<div class="aas"></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>


------解决方案--------------------
在后置背景里(也就是你这里面的div.aas)加上如下代码

position:absolute;
left:0px;
top:0px;
z-index:-1;

z-index设置的是其显示的层次先后,可以为-1,0和1。-1就是后置,1为前置,0为默认