高度塌陷和外边距折叠的完美解决代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>高度塌陷和外边距折叠的完美解决代码</title> <style> .box1{ border: 1px red solid; } .box2{ width: 200px; height: 200px; background-color: #ff0; float: left; } .box3{ width: 300px; height: 300px; background-color: orange; /* clear: both; */ } .clearfix{ content: ''; display: table; clear: both; } </style> </head> <body> <div class="box1 clearfix"> <div class="box2"></div> <div class="box3"></div> </div> </body> </html>
本文来自博客园,作者:氯丙嗪,转载请注明原文链接:https://www.cnblogs.com/YcxyH/p/16261305.html