Advertisement
shadowvzs

Untitled

Feb 23rd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Flex Example</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <style>
  8. * {
  9. /* few reset */
  10. box-sizing: border-box;
  11. padding: 0;
  12. margin: 0;
  13. }
  14. .flex-container {
  15. position: absolute;
  16. top: 0;
  17. left: 0;
  18. height: 100%;
  19. width: 100%;
  20. background-color: rgba(0,0,0,0.1);
  21. display: flex;
  22. flex-flow: row wrap;
  23. }
  24. @media only screen and (min-width: 1px) {
  25. .flex-container div:nth-child(1) {
  26. order: 1;
  27. background-color: rgba(255,0,0,0.1);
  28. height: 50%;
  29. width: 50%;
  30. }
  31. .flex-container div:nth-child(2) {
  32. order: 2;
  33. background-color: rgba(255,255,0,0.1);
  34. height: 50%;
  35. width: 50%;
  36. }
  37. .flex-container div:nth-child(3) {
  38. order: 3;
  39. background-color: rgba(255,0,255,0.1);
  40. height: 50%;
  41. width: 50%;
  42. }
  43. .flex-container div:nth-child(4) {
  44. order: 4;
  45. background-color: rgba(0,0,255,0.1);
  46. height: 50%;
  47. width: 50%;
  48. }
  49. }
  50.  
  51. @media only screen and (min-width: 500px) {
  52. .flex-container div:nth-child(1) {
  53. order: 3;
  54. background-color: rgba(255,0,0,0.1);
  55. height: 25%;
  56. width: 50%;
  57. }
  58. .flex-container div:nth-child(2) {
  59. order: 2;
  60. background-color: rgba(255,255,0,0.1);
  61. height: 25%;
  62. width: 50%;
  63. }
  64. .flex-container div:nth-child(3) {
  65. order: 4;
  66. background-color: rgba(255,0,255,0.1);
  67. height: 50%;
  68. width: 100%;
  69. }
  70. .flex-container div:nth-child(4) {
  71. order: 1;
  72. background-color: rgba(0,0,255,0.1);
  73. height: 25%;
  74. width: 100%;
  75. }
  76. }
  77.  
  78. @media only screen and (min-width: 800px) {
  79. .flex-container div:nth-child(1) {
  80. order: 2;
  81. background-color: rgba(255,0,0,0.1);
  82. height: 25%;
  83. width: 100%;
  84. }
  85. .flex-container div:nth-child(2) {
  86. order: 3;
  87. background-color: rgba(255,255,0,0.1);
  88. height: 25%;
  89. width: 100%;
  90. }
  91. .flex-container div:nth-child(3) {
  92. order: 1;
  93. background-color: rgba(255,0,255,0.1);
  94. height: 25%;
  95. width: 100%;
  96. }
  97. .flex-container div:nth-child(4) {
  98. order: 2;
  99. background-color: rgba(0,0,255,0.1);
  100. height: 25%;
  101. width: 100%;
  102. }
  103. }
  104.  
  105. @media only screen and (min-width: 1100px) {
  106. .flex-container div:nth-child(1) {
  107. order: 4;
  108. background-color: rgba(255,0,0,0.1);
  109. height: 75%;
  110. width: 100%;
  111. }
  112. .flex-container div:nth-child(2) {
  113. order: 3;
  114. background-color: rgba(255,255,0,0.1);
  115. height: 25%;
  116. width: 25%;
  117. }
  118. .flex-container div:nth-child(3) {
  119. order: 1;
  120. background-color: rgba(255,0,255,0.1);
  121. height: 25%;
  122. width: 25%;
  123. }
  124. .flex-container div:nth-child(4) {
  125. order: 2;
  126. background-color: rgba(0,0,255,0.1);
  127. height: 25%;
  128. width: 50%;
  129. }
  130. }
  131. </style>
  132. </head>
  133. <body>
  134. <div class="flex-container">
  135. <div>
  136. First Flex Item #1
  137. </div>
  138. <div>
  139. Second Flex Item #2
  140. </div>
  141. <div>
  142. Third Flex Item #3
  143. </div>
  144. <div>
  145. Fourth Flex Item #4
  146. </div>
  147. </div>
  148. </body>
  149. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement