如何使用z-index获取绝对位置元素后面的固定位置元素?

时间:2012-08-09 10:44:58

标签: z-index

<div id="bus"><img src="assets/img/bus.png" id="bus_inner"/></div>
<div id="parallax">
    <div id="bgsun" class="depth-1"></div> 
    <div id="bg" class="depth-1"></div>
    <div id="bag" class="depth-1"><img src="assets/img/bag.png" /></div>
</div>

#parallax { background: #5b3516; width: 17000px; height: 100%; position: relative; }

#bgsun { position: absolute; width: 17000px; top: 0; height: 100%; background: url("../img/bg_sun.jpg") no-repeat; z-index: 10; }

#bg.depth-1 { position: absolute; width: 17000px; top: 0; height: 100%; background: url("../img/bg.jpg") no-repeat; z-index: 20; }

#bus { position: fixed; top: 495px; left: 90px; z-index: 30; }

#bus_inner { position: absolute; top: 0; left: 0; z-index: 40; }

#bag {
    position: absolute;
    top: 55px;
    left: 7320px;
    z-index: 50;
}

#bag img {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 60;
}

试图将行李元素放在行李箱后面,但没有运气。固定位置与z-index无关吗?我将如何分层这些元素,以便订单

bgsun BG 总线 袋

它是否与页面中的订单一致?

0 个答案:

没有答案