<div class="a"> <div class="b"> <div class="c"></div> </div> </div>
.a { width: 200px; height: 200px; background: red; } .b { position: relative; width: 100px; height: 100px; background: blue; z-index: 0; /* 定位元素,且其z-index值不为auto才能构成层叠上下文 */ } .c { position: absolute; width: 150px; height: 150px; background: yellow; z-index: -1; }