5_小海豹2.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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: #cccccc;
  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: 550px;
  41. background: url(img/1.jpg) 0 0 no-repeat;
  42. background-size: 100% 100%;
  43. margin: 0 auto;
  44. }
  45. @media screen and (max-width: 960px) {
  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. padding-top: 56%;
  62. height: 0;
  63. }
  64. }
  65. @media screen and (max-width: 480px) {
  66. #left{
  67. width: 100%;
  68. }
  69. #right{
  70. width: 100%;
  71. }
  72. #imgBox{
  73. background-image: url(img/3.jpg);
  74. }
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <h3>页眉</h3>
  80. <h3>导航</h3>
  81. <div id="imgBox"></div>
  82. <div id="content">
  83. <div id="left"></div>
  84. <div id="right"></div>
  85. </div>
  86. <h3>页尾</h3>
  87. </body>
  88. </html>