box.scss 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. @mixin ext-box() {
  2. display: -webkit-box;
  3. display: -ms-flexbox;
  4. display: flex;
  5. }
  6. @mixin ext-inline-box() {
  7. display: -webkit-inline-box;
  8. display: -ms-inline-flexbox;
  9. display: inline-flex;
  10. }
  11. @mixin ext-box-align($align: stretch) {
  12. -webkit-box-align: $align;
  13. -ms-flex-align: $align;
  14. @if $align == start {
  15. align-items: flex-start;
  16. }
  17. @else if $align == end {
  18. align-items: flex-end;
  19. }
  20. @else {
  21. align-items: $align;
  22. }
  23. }
  24. @mixin ext-box-orient($orient: horizontal) {
  25. -webkit-box-orient: $orient;
  26. @if $orient == horizontal {
  27. -ms-flex-direction: row;
  28. flex-direction: row;
  29. } @else {
  30. -ms-flex-direction: column;
  31. flex-direction: column;
  32. }
  33. }
  34. @mixin ext-box-pack($pack: start) {
  35. -webkit-box-pack: $pack;
  36. -ms-flex-pack: $pack;
  37. @if $pack == start {
  38. justify-content: flex-start;
  39. }
  40. @else if $pack == end {
  41. justify-content: flex-end;
  42. }
  43. @else if $pack == justify {
  44. justify-content: space-between;
  45. }
  46. @else if $pack == center {
  47. justify-content: center;
  48. }
  49. @else {
  50. justify-content: $pack;
  51. }
  52. }
  53. @mixin ext-box-flex($flex: 1 1 auto) {
  54. -webkit-box-flex: nth($flex, 1);
  55. -ms-flex: $flex;
  56. flex: $flex;
  57. // workaround for firefox bug:
  58. // http://stackoverflow.com/questions/27424831/firefox-flexbox-overflow
  59. min-width: 0;
  60. }
  61. @mixin ext-box-direction($direction: normal, $orientation: row) {
  62. -webkit-box-direction: $direction;
  63. @if $direction == reverse {
  64. @if $orientation == row {
  65. -ms-flex-direction: row-reverse;
  66. flex-direction: row-reverse;
  67. } @else {
  68. -ms-flex-direction: column-reverse;
  69. flex-direction: column-reverse;
  70. }
  71. } @else {
  72. @if $orientation == row {
  73. -ms-flex-direction: row;
  74. flex-direction: row;
  75. } @else {
  76. -ms-flex-direction: column;
  77. flex-direction: column;
  78. }
  79. }
  80. }