columns.sass 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. @import "../utilities/mixins"
  2. $column-gap: 0.75rem !default
  3. .column
  4. display: block
  5. flex-basis: 0
  6. flex-grow: 1
  7. flex-shrink: 1
  8. padding: $column-gap
  9. .columns.is-mobile > &.is-narrow
  10. flex: none
  11. width: unset
  12. .columns.is-mobile > &.is-full
  13. flex: none
  14. width: 100%
  15. .columns.is-mobile > &.is-three-quarters
  16. flex: none
  17. width: 75%
  18. .columns.is-mobile > &.is-two-thirds
  19. flex: none
  20. width: 66.6666%
  21. .columns.is-mobile > &.is-half
  22. flex: none
  23. width: 50%
  24. .columns.is-mobile > &.is-one-third
  25. flex: none
  26. width: 33.3333%
  27. .columns.is-mobile > &.is-one-quarter
  28. flex: none
  29. width: 25%
  30. .columns.is-mobile > &.is-one-fifth
  31. flex: none
  32. width: 20%
  33. .columns.is-mobile > &.is-two-fifths
  34. flex: none
  35. width: 40%
  36. .columns.is-mobile > &.is-three-fifths
  37. flex: none
  38. width: 60%
  39. .columns.is-mobile > &.is-four-fifths
  40. flex: none
  41. width: 80%
  42. .columns.is-mobile > &.is-offset-three-quarters
  43. +ltr-property("margin", 75%, false)
  44. .columns.is-mobile > &.is-offset-two-thirds
  45. +ltr-property("margin", 66.6666%, false)
  46. .columns.is-mobile > &.is-offset-half
  47. +ltr-property("margin", 50%, false)
  48. .columns.is-mobile > &.is-offset-one-third
  49. +ltr-property("margin", 33.3333%, false)
  50. .columns.is-mobile > &.is-offset-one-quarter
  51. +ltr-property("margin", 25%, false)
  52. .columns.is-mobile > &.is-offset-one-fifth
  53. +ltr-property("margin", 20%, false)
  54. .columns.is-mobile > &.is-offset-two-fifths
  55. +ltr-property("margin", 40%, false)
  56. .columns.is-mobile > &.is-offset-three-fifths
  57. +ltr-property("margin", 60%, false)
  58. .columns.is-mobile > &.is-offset-four-fifths
  59. +ltr-property("margin", 80%, false)
  60. @for $i from 0 through 12
  61. .columns.is-mobile > &.is-#{$i}
  62. flex: none
  63. width: percentage($i / 12)
  64. .columns.is-mobile > &.is-offset-#{$i}
  65. +ltr-property("margin", percentage($i / 12), false)
  66. +mobile
  67. &.is-narrow-mobile
  68. flex: none
  69. width: unset
  70. &.is-full-mobile
  71. flex: none
  72. width: 100%
  73. &.is-three-quarters-mobile
  74. flex: none
  75. width: 75%
  76. &.is-two-thirds-mobile
  77. flex: none
  78. width: 66.6666%
  79. &.is-half-mobile
  80. flex: none
  81. width: 50%
  82. &.is-one-third-mobile
  83. flex: none
  84. width: 33.3333%
  85. &.is-one-quarter-mobile
  86. flex: none
  87. width: 25%
  88. &.is-one-fifth-mobile
  89. flex: none
  90. width: 20%
  91. &.is-two-fifths-mobile
  92. flex: none
  93. width: 40%
  94. &.is-three-fifths-mobile
  95. flex: none
  96. width: 60%
  97. &.is-four-fifths-mobile
  98. flex: none
  99. width: 80%
  100. &.is-offset-three-quarters-mobile
  101. +ltr-property("margin", 75%, false)
  102. &.is-offset-two-thirds-mobile
  103. +ltr-property("margin", 66.6666%, false)
  104. &.is-offset-half-mobile
  105. +ltr-property("margin", 50%, false)
  106. &.is-offset-one-third-mobile
  107. +ltr-property("margin", 33.3333%, false)
  108. &.is-offset-one-quarter-mobile
  109. +ltr-property("margin", 25%, false)
  110. &.is-offset-one-fifth-mobile
  111. +ltr-property("margin", 20%, false)
  112. &.is-offset-two-fifths-mobile
  113. +ltr-property("margin", 40%, false)
  114. &.is-offset-three-fifths-mobile
  115. +ltr-property("margin", 60%, false)
  116. &.is-offset-four-fifths-mobile
  117. +ltr-property("margin", 80%, false)
  118. @for $i from 0 through 12
  119. &.is-#{$i}-mobile
  120. flex: none
  121. width: percentage($i / 12)
  122. &.is-offset-#{$i}-mobile
  123. +ltr-property("margin", percentage($i / 12), false)
  124. +tablet
  125. &.is-narrow,
  126. &.is-narrow-tablet
  127. flex: none
  128. width: unset
  129. &.is-full,
  130. &.is-full-tablet
  131. flex: none
  132. width: 100%
  133. &.is-three-quarters,
  134. &.is-three-quarters-tablet
  135. flex: none
  136. width: 75%
  137. &.is-two-thirds,
  138. &.is-two-thirds-tablet
  139. flex: none
  140. width: 66.6666%
  141. &.is-half,
  142. &.is-half-tablet
  143. flex: none
  144. width: 50%
  145. &.is-one-third,
  146. &.is-one-third-tablet
  147. flex: none
  148. width: 33.3333%
  149. &.is-one-quarter,
  150. &.is-one-quarter-tablet
  151. flex: none
  152. width: 25%
  153. &.is-one-fifth,
  154. &.is-one-fifth-tablet
  155. flex: none
  156. width: 20%
  157. &.is-two-fifths,
  158. &.is-two-fifths-tablet
  159. flex: none
  160. width: 40%
  161. &.is-three-fifths,
  162. &.is-three-fifths-tablet
  163. flex: none
  164. width: 60%
  165. &.is-four-fifths,
  166. &.is-four-fifths-tablet
  167. flex: none
  168. width: 80%
  169. &.is-offset-three-quarters,
  170. &.is-offset-three-quarters-tablet
  171. +ltr-property("margin", 75%, false)
  172. &.is-offset-two-thirds,
  173. &.is-offset-two-thirds-tablet
  174. +ltr-property("margin", 66.6666%, false)
  175. &.is-offset-half,
  176. &.is-offset-half-tablet
  177. +ltr-property("margin", 50%, false)
  178. &.is-offset-one-third,
  179. &.is-offset-one-third-tablet
  180. +ltr-property("margin", 33.3333%, false)
  181. &.is-offset-one-quarter,
  182. &.is-offset-one-quarter-tablet
  183. +ltr-property("margin", 25%, false)
  184. &.is-offset-one-fifth,
  185. &.is-offset-one-fifth-tablet
  186. +ltr-property("margin", 20%, false)
  187. &.is-offset-two-fifths,
  188. &.is-offset-two-fifths-tablet
  189. +ltr-property("margin", 40%, false)
  190. &.is-offset-three-fifths,
  191. &.is-offset-three-fifths-tablet
  192. +ltr-property("margin", 60%, false)
  193. &.is-offset-four-fifths,
  194. &.is-offset-four-fifths-tablet
  195. +ltr-property("margin", 80%, false)
  196. @for $i from 0 through 12
  197. &.is-#{$i},
  198. &.is-#{$i}-tablet
  199. flex: none
  200. width: percentage($i / 12)
  201. &.is-offset-#{$i},
  202. &.is-offset-#{$i}-tablet
  203. +ltr-property("margin", percentage($i / 12), false)
  204. +touch
  205. &.is-narrow-touch
  206. flex: none
  207. width: unset
  208. &.is-full-touch
  209. flex: none
  210. width: 100%
  211. &.is-three-quarters-touch
  212. flex: none
  213. width: 75%
  214. &.is-two-thirds-touch
  215. flex: none
  216. width: 66.6666%
  217. &.is-half-touch
  218. flex: none
  219. width: 50%
  220. &.is-one-third-touch
  221. flex: none
  222. width: 33.3333%
  223. &.is-one-quarter-touch
  224. flex: none
  225. width: 25%
  226. &.is-one-fifth-touch
  227. flex: none
  228. width: 20%
  229. &.is-two-fifths-touch
  230. flex: none
  231. width: 40%
  232. &.is-three-fifths-touch
  233. flex: none
  234. width: 60%
  235. &.is-four-fifths-touch
  236. flex: none
  237. width: 80%
  238. &.is-offset-three-quarters-touch
  239. +ltr-property("margin", 75%, false)
  240. &.is-offset-two-thirds-touch
  241. +ltr-property("margin", 66.6666%, false)
  242. &.is-offset-half-touch
  243. +ltr-property("margin", 50%, false)
  244. &.is-offset-one-third-touch
  245. +ltr-property("margin", 33.3333%, false)
  246. &.is-offset-one-quarter-touch
  247. +ltr-property("margin", 25%, false)
  248. &.is-offset-one-fifth-touch
  249. +ltr-property("margin", 20%, false)
  250. &.is-offset-two-fifths-touch
  251. +ltr-property("margin", 40%, false)
  252. &.is-offset-three-fifths-touch
  253. +ltr-property("margin", 60%, false)
  254. &.is-offset-four-fifths-touch
  255. +ltr-property("margin", 80%, false)
  256. @for $i from 0 through 12
  257. &.is-#{$i}-touch
  258. flex: none
  259. width: percentage($i / 12)
  260. &.is-offset-#{$i}-touch
  261. +ltr-property("margin", percentage($i / 12), false)
  262. +desktop
  263. &.is-narrow-desktop
  264. flex: none
  265. width: unset
  266. &.is-full-desktop
  267. flex: none
  268. width: 100%
  269. &.is-three-quarters-desktop
  270. flex: none
  271. width: 75%
  272. &.is-two-thirds-desktop
  273. flex: none
  274. width: 66.6666%
  275. &.is-half-desktop
  276. flex: none
  277. width: 50%
  278. &.is-one-third-desktop
  279. flex: none
  280. width: 33.3333%
  281. &.is-one-quarter-desktop
  282. flex: none
  283. width: 25%
  284. &.is-one-fifth-desktop
  285. flex: none
  286. width: 20%
  287. &.is-two-fifths-desktop
  288. flex: none
  289. width: 40%
  290. &.is-three-fifths-desktop
  291. flex: none
  292. width: 60%
  293. &.is-four-fifths-desktop
  294. flex: none
  295. width: 80%
  296. &.is-offset-three-quarters-desktop
  297. +ltr-property("margin", 75%, false)
  298. &.is-offset-two-thirds-desktop
  299. +ltr-property("margin", 66.6666%, false)
  300. &.is-offset-half-desktop
  301. +ltr-property("margin", 50%, false)
  302. &.is-offset-one-third-desktop
  303. +ltr-property("margin", 33.3333%, false)
  304. &.is-offset-one-quarter-desktop
  305. +ltr-property("margin", 25%, false)
  306. &.is-offset-one-fifth-desktop
  307. +ltr-property("margin", 20%, false)
  308. &.is-offset-two-fifths-desktop
  309. +ltr-property("margin", 40%, false)
  310. &.is-offset-three-fifths-desktop
  311. +ltr-property("margin", 60%, false)
  312. &.is-offset-four-fifths-desktop
  313. +ltr-property("margin", 80%, false)
  314. @for $i from 0 through 12
  315. &.is-#{$i}-desktop
  316. flex: none
  317. width: percentage($i / 12)
  318. &.is-offset-#{$i}-desktop
  319. +ltr-property("margin", percentage($i / 12), false)
  320. +widescreen
  321. &.is-narrow-widescreen
  322. flex: none
  323. width: unset
  324. &.is-full-widescreen
  325. flex: none
  326. width: 100%
  327. &.is-three-quarters-widescreen
  328. flex: none
  329. width: 75%
  330. &.is-two-thirds-widescreen
  331. flex: none
  332. width: 66.6666%
  333. &.is-half-widescreen
  334. flex: none
  335. width: 50%
  336. &.is-one-third-widescreen
  337. flex: none
  338. width: 33.3333%
  339. &.is-one-quarter-widescreen
  340. flex: none
  341. width: 25%
  342. &.is-one-fifth-widescreen
  343. flex: none
  344. width: 20%
  345. &.is-two-fifths-widescreen
  346. flex: none
  347. width: 40%
  348. &.is-three-fifths-widescreen
  349. flex: none
  350. width: 60%
  351. &.is-four-fifths-widescreen
  352. flex: none
  353. width: 80%
  354. &.is-offset-three-quarters-widescreen
  355. +ltr-property("margin", 75%, false)
  356. &.is-offset-two-thirds-widescreen
  357. +ltr-property("margin", 66.6666%, false)
  358. &.is-offset-half-widescreen
  359. +ltr-property("margin", 50%, false)
  360. &.is-offset-one-third-widescreen
  361. +ltr-property("margin", 33.3333%, false)
  362. &.is-offset-one-quarter-widescreen
  363. +ltr-property("margin", 25%, false)
  364. &.is-offset-one-fifth-widescreen
  365. +ltr-property("margin", 20%, false)
  366. &.is-offset-two-fifths-widescreen
  367. +ltr-property("margin", 40%, false)
  368. &.is-offset-three-fifths-widescreen
  369. +ltr-property("margin", 60%, false)
  370. &.is-offset-four-fifths-widescreen
  371. +ltr-property("margin", 80%, false)
  372. @for $i from 0 through 12
  373. &.is-#{$i}-widescreen
  374. flex: none
  375. width: percentage($i / 12)
  376. &.is-offset-#{$i}-widescreen
  377. +ltr-property("margin", percentage($i / 12), false)
  378. +fullhd
  379. &.is-narrow-fullhd
  380. flex: none
  381. width: unset
  382. &.is-full-fullhd
  383. flex: none
  384. width: 100%
  385. &.is-three-quarters-fullhd
  386. flex: none
  387. width: 75%
  388. &.is-two-thirds-fullhd
  389. flex: none
  390. width: 66.6666%
  391. &.is-half-fullhd
  392. flex: none
  393. width: 50%
  394. &.is-one-third-fullhd
  395. flex: none
  396. width: 33.3333%
  397. &.is-one-quarter-fullhd
  398. flex: none
  399. width: 25%
  400. &.is-one-fifth-fullhd
  401. flex: none
  402. width: 20%
  403. &.is-two-fifths-fullhd
  404. flex: none
  405. width: 40%
  406. &.is-three-fifths-fullhd
  407. flex: none
  408. width: 60%
  409. &.is-four-fifths-fullhd
  410. flex: none
  411. width: 80%
  412. &.is-offset-three-quarters-fullhd
  413. +ltr-property("margin", 75%, false)
  414. &.is-offset-two-thirds-fullhd
  415. +ltr-property("margin", 66.6666%, false)
  416. &.is-offset-half-fullhd
  417. +ltr-property("margin", 50%, false)
  418. &.is-offset-one-third-fullhd
  419. +ltr-property("margin", 33.3333%, false)
  420. &.is-offset-one-quarter-fullhd
  421. +ltr-property("margin", 25%, false)
  422. &.is-offset-one-fifth-fullhd
  423. +ltr-property("margin", 20%, false)
  424. &.is-offset-two-fifths-fullhd
  425. +ltr-property("margin", 40%, false)
  426. &.is-offset-three-fifths-fullhd
  427. +ltr-property("margin", 60%, false)
  428. &.is-offset-four-fifths-fullhd
  429. +ltr-property("margin", 80%, false)
  430. @for $i from 0 through 12
  431. &.is-#{$i}-fullhd
  432. flex: none
  433. width: percentage($i / 12)
  434. &.is-offset-#{$i}-fullhd
  435. +ltr-property("margin", percentage($i / 12), false)
  436. .columns
  437. +ltr-property("margin", (-$column-gap), false)
  438. +ltr-property("margin", (-$column-gap))
  439. margin-top: (-$column-gap)
  440. &:last-child
  441. margin-bottom: (-$column-gap)
  442. &:not(:last-child)
  443. margin-bottom: calc(1.5rem - #{$column-gap})
  444. // Modifiers
  445. &.is-centered
  446. justify-content: center
  447. &.is-gapless
  448. +ltr-property("margin", 0, false)
  449. +ltr-property("margin", 0)
  450. margin-top: 0
  451. & > .column
  452. margin: 0
  453. padding: 0 !important
  454. &:not(:last-child)
  455. margin-bottom: 1.5rem
  456. &:last-child
  457. margin-bottom: 0
  458. &.is-mobile
  459. display: flex
  460. &.is-multiline
  461. flex-wrap: wrap
  462. &.is-vcentered
  463. align-items: center
  464. // Responsiveness
  465. +tablet
  466. &:not(.is-desktop)
  467. display: flex
  468. +desktop
  469. // Modifiers
  470. &.is-desktop
  471. display: flex
  472. @if $variable-columns
  473. .columns.is-variable
  474. --columnGap: 0.75rem
  475. +ltr-property("margin", calc(-1 * var(--columnGap)), false)
  476. +ltr-property("margin", calc(-1 * var(--columnGap)))
  477. > .column
  478. padding-left: var(--columnGap)
  479. padding-right: var(--columnGap)
  480. @for $i from 0 through 8
  481. &.is-#{$i}
  482. --columnGap: #{$i * 0.25rem}
  483. +mobile
  484. &.is-#{$i}-mobile
  485. --columnGap: #{$i * 0.25rem}
  486. +tablet
  487. &.is-#{$i}-tablet
  488. --columnGap: #{$i * 0.25rem}
  489. +tablet-only
  490. &.is-#{$i}-tablet-only
  491. --columnGap: #{$i * 0.25rem}
  492. +touch
  493. &.is-#{$i}-touch
  494. --columnGap: #{$i * 0.25rem}
  495. +desktop
  496. &.is-#{$i}-desktop
  497. --columnGap: #{$i * 0.25rem}
  498. +desktop-only
  499. &.is-#{$i}-desktop-only
  500. --columnGap: #{$i * 0.25rem}
  501. +widescreen
  502. &.is-#{$i}-widescreen
  503. --columnGap: #{$i * 0.25rem}
  504. +widescreen-only
  505. &.is-#{$i}-widescreen-only
  506. --columnGap: #{$i * 0.25rem}
  507. +fullhd
  508. &.is-#{$i}-fullhd
  509. --columnGap: #{$i * 0.25rem}