_flexbox.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // --------------------------------------------------
  2. // Flexbox SASS mixins
  3. // The spec: http://www.w3.org/TR/css3-flexbox
  4. // --------------------------------------------------
  5. // Flexbox display
  6. @mixin flexbox() {
  7. display: -webkit-box;
  8. display: -moz-box;
  9. display: -ms-flexbox;
  10. display: -webkit-flex;
  11. display: flex;
  12. }
  13. // The 'flex' shorthand
  14. // - applies to: flex items
  15. // <positive-number>, initial, auto, or none
  16. @mixin flex($values) {
  17. -webkit-box-flex: $values;
  18. -moz-box-flex: $values;
  19. -webkit-flex: $values;
  20. -ms-flex: $values;
  21. flex: $values;
  22. }
  23. // Flex Flow Direction
  24. // - applies to: flex containers
  25. // row | row-reverse | column | column-reverse
  26. @mixin flex-direction($direction) {
  27. -webkit-flex-direction: $direction;
  28. -moz-flex-direction: $direction;
  29. -ms-flex-direction: $direction;
  30. flex-direction: $direction;
  31. }
  32. // Flex Line Wrapping
  33. // - applies to: flex containers
  34. // nowrap | wrap | wrap-reverse
  35. @mixin flex-wrap($wrap) {
  36. -webkit-flex-wrap: $wrap;
  37. -moz-flex-wrap: $wrap;
  38. -ms-flex-wrap: $wrap;
  39. flex-wrap: $wrap;
  40. }
  41. // Flex Direction and Wrap
  42. // - applies to: flex containers
  43. // <flex-direction> || <flex-wrap>
  44. @mixin flex-flow($flow) {
  45. -webkit-flex-flow: $flow;
  46. -moz-flex-flow: $flow;
  47. -ms-flex-flow: $flow;
  48. flex-flow: $flow;
  49. }
  50. // Display Order
  51. // - applies to: flex items
  52. // <integer>
  53. @mixin order($val) {
  54. -webkit-box-ordinal-group: $val;
  55. -moz-box-ordinal-group: $val;
  56. -ms-flex-order: $val;
  57. -webkit-order: $val;
  58. order: $val;
  59. }
  60. // Flex grow factor
  61. // - applies to: flex items
  62. // <number>
  63. @mixin flex-grow($grow) {
  64. -webkit-flex-grow: $grow;
  65. -moz-flex-grow: $grow;
  66. -ms-flex-grow: $grow;
  67. flex-grow: $grow;
  68. }
  69. // Flex shrink
  70. // - applies to: flex item shrink factor
  71. // <number>
  72. @mixin flex-shrink($shrink) {
  73. -webkit-flex-shrink: $shrink;
  74. -moz-flex-shrink: $shrink;
  75. -ms-flex-shrink: $shrink;
  76. flex-shrink: $shrink;
  77. }
  78. // Flex basis
  79. // - the initial main size of the flex item
  80. // - applies to: flex itemsnitial main size of the flex item
  81. // <width>
  82. @mixin flex-basis($width) {
  83. -webkit-flex-basis: $width;
  84. -moz-flex-basis: $width;
  85. -ms-flex-basis: $width;
  86. flex-basis: $width;
  87. }
  88. // Axis Alignment
  89. // - applies to: flex containers
  90. // flex-start | flex-end | center | space-between | space-around
  91. @mixin justify-content($justify) {
  92. -webkit-justify-content: $justify;
  93. -moz-justify-content: $justify;
  94. -ms-justify-content: $justify;
  95. justify-content: $justify;
  96. -ms-flex-pack: $justify;
  97. }
  98. // Packing Flex Lines
  99. // - applies to: multi-line flex containers
  100. // flex-start | flex-end | center | space-between | space-around | stretch
  101. @mixin align-content($align) {
  102. -webkit-align-content: $align;
  103. -moz-align-content: $align;
  104. -ms-align-content: $align;
  105. align-content: $align;
  106. }
  107. // Cross-axis Alignment
  108. // - applies to: flex containers
  109. // flex-start | flex-end | center | baseline | stretch
  110. @mixin align-items($align) {
  111. -webkit-align-items: $align;
  112. -moz-align-items: $align;
  113. -ms-align-items: $align;
  114. -ms-flex-align: $align;
  115. align-items: $align;
  116. }
  117. // Cross-axis Alignment
  118. // - applies to: flex items
  119. // auto | flex-start | flex-end | center | baseline | stretch
  120. @mixin align-self($align) {
  121. -webkit-align-self: $align;
  122. -moz-align-self: $align;
  123. -ms-align-self: $align;
  124. align-self: $align;
  125. }