5_小海豹2.html 1.6 KB

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