<style>.x{width: 500px;height:1000px;background: yellow;position: relative;}.y1{width: 100px;height: 100px;top:100px;position: relative;background: red;}.y2{width: 100px;height: 100px;top:0px;position: relative;background: green;}</style><div class="x"> <div class="y1"> </div> <div class="y2"> </div></div>上述代碼的結(jié)果如下圖所示,我在相對(duì)定位中使用top,當(dāng)top=0px時(shí),為什么.y2完全蓋住了.y1,我用的可是相對(duì)定位???謝謝
在相對(duì)定位中使用top等屬性,為什么會(huì)出現(xiàn)div重疊的情況?
慕桂英3389331
2018-09-08 09:09:29