练习1_两列布局.html 782 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. *{
  9. margin: 0;
  10. padding: 0;
  11. }
  12. .box{
  13. height: 500px;
  14. position: relative;
  15. }
  16. .div1{
  17. width: 300px;
  18. height: 100%;
  19. background-color: red;
  20. }
  21. .div2{
  22. position: absolute;
  23. left: 300px;
  24. top: 0;
  25. right: 0;
  26. bottom: 0;
  27. background-color: blue;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div class="box">
  33. <div class="div1"></div>
  34. <div class="div2"></div>
  35. </div>
  36. </body>
  37. </html>