_mixins.grid.scss 2.0 KB

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