4_小海豹.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: 960px;
  15. height: 50px;
  16. background: #cccccc;
  17. text-align: center;
  18. line-height: 50px;
  19. margin: 0 auto 10px;
  20. }
  21. #img1{
  22. display: block;
  23. margin: 0 auto;
  24. width: 960px;
  25. }
  26. #img2,#img3{
  27. display: none;
  28. }
  29. #content {
  30. width: 960px;
  31. overflow: hidden;
  32. margin: 10px auto;
  33. }
  34. #left{
  35. width: 630px;
  36. height: 300px;
  37. background: red;
  38. float: left;
  39. }
  40. #right{
  41. width: 300px;
  42. height: 300px;
  43. background: blue;
  44. float: right;
  45. }
  46. @media screen and (max-width: 960px) {
  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: 33%;
  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. }
  78. #right{
  79. width: 100%;
  80. }
  81. }
  82. </style>
  83. </head>
  84. <body>
  85. <h3>页眉</h3>
  86. <h3>导航</h3>
  87. <img src="img/1.jpg" alt="" id="img1">
  88. <img src="img/2.jpg" alt="" id="img2">
  89. <img src="img/3.jpg" alt="" id="img3">
  90. <div id="content">
  91. <div id="left"></div>
  92. <div id="right"></div>
  93. </div>
  94. <h3>页脚</h3>
  95. </body>
  96. </html>