4_小海豹.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. h3{
  14. width: 980px;
  15. height: 50px;
  16. background: #ccc;
  17. text-align: center;
  18. line-height: 50px;
  19. margin: 0 auto 10px;
  20. }
  21. #img1{
  22. width: 980px;
  23. margin: 0 auto;
  24. display: block;
  25. }
  26. #img2,#img3{
  27. display: none;
  28. }
  29. #content{
  30. width: 980px;
  31. margin: 10px auto;
  32. overflow: hidden;
  33. }
  34. #left{
  35. width: 630px;
  36. height: 300px;
  37. background: red;
  38. float: left;
  39. }
  40. #right{
  41. width: 340px;
  42. height: 300px;
  43. background: blue;
  44. float: right;
  45. }
  46. @media screen and (max-width: 980px) {
  47. h3{
  48. width: 100%;
  49. }
  50. #img1,#img3{
  51. display: none;
  52. }
  53. #img2{
  54. display: block;
  55. width: 100%;
  56. }
  57. #content{
  58. width: 100%;
  59. }
  60. #left{
  61. width: 65%;
  62. }
  63. #right{
  64. width: 34%;
  65. }
  66. }
  67. @media screen and (max-width: 480px) {
  68. #img1,#img2{
  69. display: none;
  70. }
  71. #img3{
  72. display: block;
  73. width: 100%;
  74. }
  75. #left{
  76. width: 100%;
  77. float: none;
  78. }
  79. #right{
  80. width: 100%;
  81. float: none;
  82. }
  83. }
  84. </style>
  85. </head>
  86. <body>
  87. <h3>页眉</h3>
  88. <h3>导航</h3>
  89. <img id="img1" src="img/1.jpg" alt="">
  90. <img id="img2" src="img/2.jpg" alt="">
  91. <img id="img3" src="img/3.jpg" alt="">
  92. <div id="content">
  93. <div id="left"></div>
  94. <div id="right"></div>
  95. </div>
  96. <h3>页尾</h3>
  97. </body>
  98. </html>