Guest User

Untitled

a guest
Jul 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <style>
  7. .grid-container{
  8. width: 100%;
  9. max-width: 1200px;
  10. }
  11.  
  12. /*-- 使用 cleafix 清除浮动 -- */
  13. .row{
  14. border: none;
  15. }
  16. .row:before,
  17. .row:after {
  18. content:"";
  19. display: table ;
  20. clear:both;
  21. }
  22.  
  23. [class*='col-'] {
  24. float: left;
  25. min-height: 1px;
  26. width: 16.66%;
  27. /*-- 设置列的左右间隙 -- */
  28. padding: 12px;
  29. background-color: #FFDCDC;
  30. }
  31.  
  32. .col-1{ width: 16.66%; }
  33. .col-2{ width: 33.33%; }
  34. .col-3{ width: 50%; }
  35. .col-4{ width: 66.66%; }
  36. .col-5{ width: 83.33%; }
  37. .col-6{ width: 100%; }
  38.  
  39. .outline, .outline *{
  40. outline: 1px solid #F6A1A1;
  41. }
  42.  
  43. /*-- 列的额外内容样式 --*/
  44. [class*='col-'] > p {
  45. background-color: #FFC2C2;
  46. padding: 0;
  47. margin: 0;
  48. text-align: center;
  49. color: white;
  50. }
  51. @media all and (max-width:800px){
  52. .col-1{ width: 33.33%; }
  53. .col-2{ width: 50%; }
  54. .col-3{ width: 83.33%; }
  55. .col-4{ width: 100%; }
  56. .col-5{ width: 100%; }
  57. .col-6{ width: 100%; }
  58.  
  59. .row .col-2:last-of-type{
  60. width: 100%;
  61. }
  62.  
  63. .row .col-5 ~ .col-1{
  64. width: 100%;
  65. }
  66. }
  67. @media all and (max-width:650px){
  68. .col-1{ width: 50%; }
  69. .col-2{ width: 100%; }
  70. .col-3{ width: 100%; }
  71. .col-4{ width: 100%; }
  72. .col-5{ width: 100%; }
  73. .col-6{ width: 100%; }
  74. }
  75. </style>
  76. </head>
  77. <body>
  78. <div class="grid-container outline">
  79. <div class="row">
  80. <div class="col-1"><p>col-1</p></div>
  81. <div class="col-1"><p>col-1</p></div>
  82. <div class="col-1"><p>col-1</p></div>
  83. <div class="col-1"><p>col-1</p></div>
  84. <div class="col-1"><p>col-1</p></div>
  85. <div class="col-1"><p>col-1</p></div>
  86. </div>
  87. <div class="row">
  88. <div class="col-2"><p>col-2</p></div>
  89. <div class="col-2"><p>col-2</p></div>
  90. <div class="col-2"><p>col-2</p></div>
  91. </div>
  92. <div class="row">
  93. <div class="col-3"><p>col-3</p></div>
  94. <div class="col-3"><p>col-3</p></div>
  95. </div>
  96. </div>
  97. </body>
  98. </html>
Add Comment
Please, Sign In to add comment