6_左侧固定 右侧自适应2.html 563 B

1234567891011121314151617181920212223242526272829303132
  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. *{
  10. margin: 0;
  11. padding: 0;
  12. }
  13. body{
  14. display: flex;
  15. }
  16. #div1{
  17. width: 200px;
  18. height: 200px;
  19. background: red;
  20. }
  21. #div2{
  22. height: 200px;
  23. background: green;
  24. flex: 1;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div id="div1"></div>
  30. <div id="div2"></div>
  31. </body>
  32. </html>