06.高度塌陷的最终解决方案.html 754 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. .box1{
  10. border: 10px red solid;
  11. }
  12. .box2{
  13. width: 100px;
  14. height: 100px;
  15. background-color: #bfa;
  16. float: left;
  17. }
  18. .box3{
  19. clear: both;
  20. }
  21. .box1::after{
  22. content: '';
  23. display: block;
  24. clear: both;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="box1">
  30. <div class="box2"></div>
  31. <!-- <div class="box3"></div> -->
  32. </div>
  33. </body>
  34. </html>