<style> .box{ /*这里让父级元素变成bfc,目的是让子元素不会影响到父级*/ position: relative; width: 100px; border: 1px solid black; background-color: red; } .box1{ float: left; width: 100px; height: 100px; background-color: green; } </style> </head> <body> <div class="box"> <div class="box1"></div> </div> </body>
03_高度坍塌
最新推荐文章于 2024-08-25 21:41:11 发布