6.左侧固定右侧自适应.html 668 B

1234567891011121314151617181920212223242526272829303132333435
  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. body {
  13. /* position: relative; */
  14. }
  15. #box1 {
  16. width: 300px;
  17. height: 300px;
  18. background: #00f;
  19. position: absolute;
  20. }
  21. #box2 {
  22. height: 300px;
  23. background: #f00;
  24. margin-left: 320px;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div id="box1"></div>
  30. <div id="box2"></div>
  31. </body>
  32. </html>