_mixins.grid.scss 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Utility variable - you should never need to modify this
  2. $padding: $grid-gutter-width * 0.5;
  3. // Our row container
  4. @mixin row($padding: 0) {
  5. @include clearfix();
  6. box-sizing: border-box;
  7. display: block;
  8. margin-right: auto;
  9. margin-left: auto;
  10. padding-right: $padding;
  11. padding-left: $padding;
  12. }
  13. @mixin row-flush() {
  14. margin-left: -$padding;
  15. margin-right: -$padding;
  16. }
  17. // Our column container
  18. @mixin column($x, $padding: $padding, $grid-columns: $grid-columns) {
  19. box-sizing: border-box;
  20. display: inline;
  21. float: left;
  22. width: 100% * ($x / $grid-columns);
  23. padding-right: $padding;
  24. padding-left: $padding;
  25. }
  26. @mixin table-column($x, $padding: $padding, $grid-columns: $grid-columns) {
  27. box-sizing: border-box;
  28. width: 100% * ($x / $grid-columns);
  29. }
  30. // Push adds left padding
  31. @mixin push($offset: 1, $grid-columns: $grid-columns) {
  32. margin-left: 100% * ($offset / $grid-columns);
  33. }
  34. @mixin push-padding($offset: 1, $grid-columns: $grid-columns) {
  35. padding-left: 100% * ($offset / $grid-columns);
  36. }
  37. // Pull adds right padding
  38. @mixin pull($offset: 1, $grid-columns: $grid-columns) {
  39. margin-right: 100% * ($offset / $grid-columns);
  40. }
  41. @mixin pull-padding($offset: 1, $grid-columns: $grid-columns) {
  42. padding-right: 100% * ($offset / $grid-columns);
  43. }
  44. // only used in places where padding not applied to same elements as row or row-flush
  45. // most of the time this class should be applied directly to the html elements
  46. @mixin nice-padding {
  47. padding-left: $mobile-nice-padding;
  48. padding-right: $mobile-nice-padding;
  49. @include media-breakpoint-up(sm) {
  50. padding-left: $desktop-nice-padding;
  51. padding-right: $desktop-nice-padding;
  52. }
  53. }
  54. @mixin nice-margin {
  55. margin-left: $mobile-nice-padding;
  56. margin-right: $mobile-nice-padding;
  57. @include media-breakpoint-up(sm) {
  58. margin-left: $desktop-nice-padding;
  59. margin-right: $desktop-nice-padding;
  60. }
  61. }