grid.less 5.5 KB

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