<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>上述代碼的結果如下圖所示,我在相對定位中使用top,當top=0px時,為什么.y2完全蓋住了.y1,我用的可是相對定位啊?謝謝
在相對定位中使用top等屬性,為什么會出現div重疊的情況?
慕桂英3389331
2018-09-08 09:09:29