7.小海豹demo.css 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. }
  5. h3 {
  6. width: 960px;
  7. height: 50px;
  8. background: #ccc;
  9. color: #000;
  10. text-align: center;
  11. line-height: 50px;
  12. margin-bottom: 10px;
  13. }
  14. .main {
  15. width: 960px;
  16. margin: 10px auto;
  17. overflow: hidden;
  18. }
  19. .left {
  20. width: 630px;
  21. height: 300px;
  22. background: #f00;
  23. float: left;
  24. }
  25. .right {
  26. width: 320px;
  27. height: 300px;
  28. background: #00f;
  29. float: right;
  30. }
  31. #imgBox {
  32. width: 960px;
  33. height: 500px;
  34. background: url("../img/1.jpg");
  35. background-repeat: no-repeat;
  36. background-size: cover;
  37. }
  38. @media screen and (max-width:480px) {
  39. #imgBox {
  40. width: 100%;
  41. height: 0px;
  42. padding-top: 58%;
  43. background: url(../img/3.jpg);
  44. background-repeat: no-repeat;
  45. background-size: contain;
  46. }
  47. h3 {
  48. width: 100%;
  49. }
  50. .main {
  51. width: 100%;
  52. }
  53. .left {
  54. width: 100%;
  55. }
  56. .right {
  57. width: 100%;
  58. }
  59. }
  60. @media screen and (min-width:960px) {
  61. #imgBox {
  62. width: 100%;
  63. height: 0px;
  64. padding-top: 58%;
  65. background: url(../img/2.jpg);
  66. background-repeat: no-repeat;
  67. background-size: contain;
  68. }
  69. h3 {
  70. width: 100%;
  71. }
  72. .main {
  73. width: 100%;
  74. }
  75. .left {
  76. width: 63%;
  77. }
  78. .right {
  79. width: 34%;
  80. }
  81. }