grid.less 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. .box > p {
  2. text-align: left;
  3. }
  4. .container {
  5. display: grid;
  6. margin-bottom: 15px;
  7. & > div {
  8. display: flex;
  9. align-items: center;
  10. justify-content: center;
  11. p {
  12. font-size: 30px;
  13. }
  14. &:nth-child(1) {
  15. background-color: #ef342a;
  16. }
  17. &:nth-child(2) {
  18. background-color: #f68f26;
  19. }
  20. &:nth-child(3) {
  21. background-color: #4ba946;
  22. }
  23. &:nth-child(4) {
  24. background-color: #0376c2;
  25. }
  26. &:nth-child(5) {
  27. background-color: #c077af;
  28. }
  29. &:nth-child(6) {
  30. background-color: #f8d29d;
  31. }
  32. &:nth-child(7) {
  33. background-color: #b5a87f;
  34. }
  35. &:nth-child(8) {
  36. background-color: #d0e4a9;
  37. }
  38. &:nth-child(9) {
  39. background-color: #4dc7ec;
  40. }
  41. }
  42. &.one {
  43. grid-template-columns: 100px 100px 100px;
  44. grid-template-rows: 100px 100px 100px;
  45. }
  46. &.two {
  47. grid-template-columns: 33.33% 33.33% 33.33%;
  48. grid-template-rows: 33.33% 33.33% 33.33%;
  49. }
  50. &.three {
  51. grid-template-columns: repeat(3, 33.33%);
  52. grid-template-rows: repeat(3, 33.33%);
  53. }
  54. &.four {
  55. grid-template-columns: repeat(auto-fill, 100px);
  56. }
  57. &.five {
  58. grid-template-columns: 1fr 1fr 1fr;
  59. }
  60. &.six {
  61. grid-template-columns: 150px 1fr 2fr;
  62. }
  63. &.seven {
  64. grid-template-columns: 1fr 1fr minmax(100px, 1fr);
  65. }
  66. &.eight {
  67. grid-template-columns: 100px auto 100px;
  68. }
  69. &.nine {
  70. grid-template-columns: [c1] 100px [c2] 100px [c3] auto [c4];
  71. grid-template-areas: [r1] 100px [r2] 100px [r3] auto [r4];
  72. }
  73. &.ten-1 {
  74. grid-template-columns: 70% 30%;
  75. }
  76. &.ten-2 {
  77. grid-template-columns: repeat(12, 1fr);
  78. }
  79. &.eleven {
  80. grid-template-columns: repeat(3, 1fr);
  81. grid-template-rows: repeat(3, 1fr);
  82. grid-row-gap: 5px;
  83. grid-column-gap: 5px;
  84. }
  85. &.twelve {
  86. /*grid-template-columns: repeat(3,1fr);*/
  87. /*grid-template-rows: repeat(3,1fr);*/
  88. /*grid-template-areas: 'a b c'
  89. 'd e f'
  90. 'g h i';*/
  91. /*grid-template-areas: 'a a a'
  92. 'b b b'
  93. 'c c c';*/
  94. /*grid-template-areas: "header header header"
  95. "main main sidebar"
  96. "footer footer footer";*/
  97. grid-template-areas: 'a . c' 'd . f' 'g . i';
  98. }
  99. &.twelve-1 {
  100. grid-auto-flow: column;
  101. }
  102. &.style {
  103. & > div {
  104. border: 1px solid #e5e4e9;
  105. &:nth-child(1) {
  106. grid-column-start: 1;
  107. grid-column-end: 3;
  108. }
  109. &:nth-child(2) {
  110. grid-column-start: 1;
  111. grid-column-end: 3;
  112. }
  113. }
  114. }
  115. &.twelve-3 {
  116. grid-auto-flow: row dense;
  117. }
  118. &.twelve-4 {
  119. grid-auto-flow: column dense;
  120. }
  121. &.thirteen {
  122. grid-template-columns: 100px 100px 100px;
  123. grid-template-rows: 100px 100px 100px;
  124. justify-items: start;
  125. }
  126. &.thirteen-1 {
  127. grid-template-columns: 100px 100px 100px;
  128. grid-template-rows: 100px 100px 100px;
  129. align-items: start;
  130. p {
  131. font-size: initial;
  132. }
  133. }
  134. &.thirteen-2 {
  135. grid-template-columns: 100px 100px 100px;
  136. grid-template-rows: 100px 100px 100px;
  137. place-items: start end;
  138. p {
  139. font-size: initial;
  140. }
  141. }
  142. &.fourteen {
  143. grid-template-columns: 100px 100px 100px;
  144. grid-template-rows: 100px 100px 100px;
  145. }
  146. &.fourteen-1 {
  147. justify-content: start;
  148. }
  149. &.fourteen-2 {
  150. justify-content: end;
  151. }
  152. &.fourteen-3 {
  153. justify-content: center;
  154. }
  155. &.fourteen-4 {
  156. grid-template-columns: repeat(3, 1fr);
  157. grid-template-rows: repeat(3, 1fr);
  158. justify-content: stretch;
  159. }
  160. &.fourteen-5 {
  161. justify-content: space-around;
  162. }
  163. &.fourteen-6 {
  164. justify-content: space-between;
  165. }
  166. &.fourteen-7 {
  167. place-content: space-around space-evenly;
  168. }
  169. &.fifteen {
  170. grid-template-columns: 100px 100px 100px;
  171. grid-template-rows: 100px 100px 100px;
  172. grid-auto-rows: 50px;
  173. & > div {
  174. &:nth-child(8) {
  175. grid-row-start: 4;
  176. grid-column-start: 2;
  177. }
  178. &:nth-child(9) {
  179. grid-row-start: 5;
  180. grid-column-start: 3;
  181. }
  182. }
  183. }
  184. &.sixteen {
  185. grid-template-columns: 100px 100px 100px;
  186. grid-template-rows: 100px 100px 100px;
  187. & > div {
  188. height: 100px;
  189. &:nth-child(1) {
  190. height: inherit;
  191. }
  192. }
  193. &.sixteen-1 {
  194. & > div:nth-child(1) {
  195. grid-column-start: 2;
  196. grid-column-end: 4;
  197. }
  198. }
  199. &.sixteen-2 {
  200. & > div:nth-child(1) {
  201. grid-column-start: 1;
  202. grid-column-end: 3;
  203. grid-row-start: 2;
  204. grid-row-end: 4;
  205. }
  206. }
  207. &.sixteen-3 {
  208. & > div:nth-child(1) {
  209. grid-column-start: header-start;
  210. grid-column-end: header-end;
  211. }
  212. }
  213. &.sixteen-4 {
  214. & > div:nth-child(1) {
  215. grid-column-start: span 2;
  216. }
  217. }
  218. &.sixteen-5 {
  219. & > div:nth-child(1) {
  220. grid-column: 1 / 3;
  221. grid-row: 1 / 2;
  222. }
  223. }
  224. &.sixteen-6 {
  225. & > div:nth-child(1) {
  226. grid-column: 1 / span 2;
  227. grid-row: 1 / span 2;
  228. }
  229. }
  230. &.sixteen-7 {
  231. & > div:nth-child(1) {
  232. grid-column: 2;
  233. grid-row: 2;
  234. }
  235. }
  236. }
  237. &.seventeen {
  238. grid-template-columns: 100px 100px 100px;
  239. grid-template-rows: 100px 100px 100px;
  240. grid-template-areas: 'a b c' 'd e f' 'g h i';
  241. &.seventeen-1 {
  242. & > div:nth-child(1) {
  243. grid-area: e;
  244. }
  245. }
  246. &.seventeen-2 {
  247. & > div:nth-child(1) {
  248. grid-area: 1 / 1 / 3 / 3;
  249. }
  250. }
  251. }
  252. }