_grid.scss 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* ==================
  2. 栅栏
  3. ==================== */
  4. @use 'sass:math';
  5. @mixin make_col($screen) {
  6. @for $i from 1 through 12 {
  7. .ui-col-#{$screen}-#{$i} {
  8. width: calc(100% / 12 * #{$i});
  9. }
  10. .ui-cols-#{$screen}-#{$i} .ui-item {
  11. width: calc(100% / #{$i});
  12. }
  13. }
  14. }
  15. .ui-container {
  16. box-sizing: border-box;
  17. margin-left: auto;
  18. margin-right: auto;
  19. padding-left: 30rpx;
  20. padding-right: 30rpx;
  21. width: 100%;
  22. max-width: 1440px;
  23. &-fluid {
  24. max-width: 100%;
  25. padding-left: 0;
  26. padding-right: 0;
  27. }
  28. }
  29. .ui-grid {
  30. display: flex;
  31. flex-wrap: wrap;
  32. &.multi-column {
  33. display: block;
  34. column-count: 2;
  35. column-width: 0px;
  36. column-gap: 0px;
  37. > .ui-item {
  38. break-inside: avoid;
  39. padding: 0.001em;
  40. }
  41. }
  42. &.grid-square {
  43. overflow: hidden;
  44. > .ui-item {
  45. margin-right: 20rpx;
  46. margin-bottom: 20rpx;
  47. position: relative;
  48. overflow: hidden;
  49. }
  50. @for $i from 1 through 12 {
  51. &.ui-cols-#{$i} > .ui-item {
  52. padding-bottom: calc((100% - #{20rpx * ($i - 1)}) / #{$i});
  53. height: 0;
  54. width: calc((100% - #{20rpx * ($i - 1)}) / #{$i});
  55. }
  56. }
  57. @for $i from 1 through 12 {
  58. &.ui-cols-#{$i} > .ui-item:nth-child(#{$i}n) {
  59. margin-right: 0;
  60. }
  61. }
  62. }
  63. }
  64. @for $i from 1 through 12 {
  65. .ui-cols-#{$i} .ui-item {
  66. width: calc(100% / #{$i});
  67. }
  68. }
  69. @for $i from 1 through 12 {
  70. .ui-col-#{$i} {
  71. width: calc(100% / 12 * #{$i});
  72. }
  73. }
  74. // 小屏
  75. @media screen and (min-width: 0px) {
  76. @include make_col('xs');
  77. }
  78. // 小屏
  79. @media screen and (min-width: 320px) {
  80. @include make_col('sm');
  81. }
  82. // 中屏
  83. @media screen and (min-width: 768px) {
  84. @include make_col('md');
  85. }
  86. // 普通屏
  87. @media screen and (min-width: 1025px) {
  88. @include make_col('lg');
  89. }
  90. // 大屏
  91. @media screen and (min-width: 1440px) {
  92. @include make_col('xl');
  93. }
  94. // 超大屏
  95. @media screen and (min-width: 1920px) {
  96. @include make_col('xxl');
  97. }