浮动和定位脱标的不同(文本文字滞留问题)
<body> <div class="top"></div> <div class="bottom">文字文字文字文字文字</div> </body>
1.使用浮动文字会有滞留问题
<style> .bottom { width: 200px; height: 300px; background: rgb(212, 23, 23); } .top { width: 200px; height: 200px; background: rgb(51, 36, 36); float: left ; } </style>
2.使用定位不会出现文字滞留问题
<style> .bottom { width: 200px; height: 300px; background: rgb(212, 23, 23); } .top { width: 200px; height: 200px; background: rgb(51, 36, 36); position: absolute; }
【转载文章务必保留出处和署名,谢谢!】