5_小海豹2.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #imgBox {
  22. width: 960px;
  23. height: 550px;
  24. background: url(img/1.jpg) 0 0 no-repeat;
  25. background-size: 100% 100%;
  26. margin: 0 auto;
  27. }
  28. #content {
  29. width: 960px;
  30. margin: 10px auto;
  31. overflow: hidden;
  32. }
  33. #left {
  34. width: 630px;
  35. height: 300px;
  36. background: red;
  37. float: left;
  38. }
  39. #right {
  40. width: 300px;
  41. height: 300px;
  42. background: blue;
  43. float: right;
  44. }
  45. @media screen and (max-width: 960px) {
  46. h3 {
  47. width: 100%;
  48. }
  49. #imgBox {
  50. width: 100%;
  51. background-image: url(img/2.jpg);
  52. padding-top: 56%;
  53. height: 0;
  54. /* background-size: cover; */
  55. /*
  56. 960 540
  57. 100 56%
  58. */
  59. }
  60. #content {
  61. width: 100%;
  62. }
  63. #left {
  64. width: 65%;
  65. }
  66. #right {
  67. width: 33%;
  68. }
  69. }
  70. @media screen and (max-width: 480px) {
  71. #left{
  72. width: 100%;
  73. }
  74. #right{
  75. width: 100%;
  76. }
  77. #imgBox{
  78. background-image: url(img/3.jpg);
  79. }
  80. }
  81. </style>
  82. </head>
  83. <body>
  84. <h3>页眉</h3>
  85. <h3>导航</h3>
  86. <div id="imgBox"></div>
  87. <div id="content">
  88. <div id="left"></div>
  89. <div id="right"></div>
  90. </div>
  91. <h3>页脚</h3>
  92. </body>
  93. </html>