练习3_两列布局.html 779 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. body{
  9. margin: 0;
  10. }
  11. .box{
  12. margin-left: 200px;
  13. }
  14. .div1{
  15. width: 200px;
  16. height: 100px;
  17. background-color: blue;
  18. float: left;
  19. transform: translateX(-200px);
  20. }
  21. .div2{
  22. float: left;
  23. width: 100%;
  24. height: 100px;
  25. background-color: red;
  26. margin-left: -200px;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="box">
  32. <div class="div1"></div>
  33. <div class="div2"></div>
  34. </div>
  35. </body>
  36. </html>