common.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // 全局宽度
  2. .o-w {
  3. width: 100%;
  4. }
  5. .o-h {
  6. height: 100%;
  7. }
  8. .c-text-c {
  9. text-align: center;
  10. }
  11. .c-text-r {
  12. text-align: right;
  13. }
  14. .c-text-b {
  15. font-weight: bold;
  16. }
  17. // 盒模型转换
  18. .l-bs {
  19. box-sizing: border-box;
  20. }
  21. // 全局阴影
  22. .l-boxShadow {
  23. box-shadow: 0px 0px 12rpx rgba(0, 0, 0, 0.16);
  24. }
  25. // 自定义全局flex
  26. .l-flex-center {
  27. display: flex;
  28. justify-content: center;
  29. align-items: center;
  30. }
  31. .l-flex-RC {
  32. display: flex;
  33. align-items: center;
  34. }
  35. .l-flex-between {
  36. display: flex;
  37. justify-content: space-between;
  38. align-items: center;
  39. }
  40. .l-f {
  41. display: flex;
  42. }
  43. .l-flex-d {
  44. flex-direction: column;
  45. }
  46. .l-flex-w {
  47. flex-wrap: wrap;
  48. }
  49. .l-flex-j-c {
  50. justify-content: center;
  51. }
  52. .l-flex-j-b {
  53. justify-content: space-between;
  54. }
  55. .l-flex-j-a {
  56. justify-content: space-around;
  57. }
  58. .l-flex-c {
  59. align-items: center;
  60. }
  61. .l-flex-j-e {
  62. justify-content: flex-end;
  63. }
  64. .l-flex-j-s {
  65. justify-content: flex-start;
  66. }
  67. // 定位相关
  68. .l-re {
  69. position: relative;
  70. }
  71. .l-ab {
  72. position: absolute;
  73. }
  74. .l-fixed {
  75. position: fixed;
  76. }
  77. .l-scroll {
  78. position: absolute;
  79. top: 0;
  80. left: 0;
  81. right: 0;
  82. bottom: 0;
  83. }
  84. .l-fill {
  85. position: fixed;
  86. top: 0;
  87. left: 0;
  88. right: 0;
  89. bottom: 0;
  90. }
  91. // 颜色相关
  92. .c-color-0 {
  93. color: #000000;
  94. }
  95. .c-color-1 {
  96. color: #111111;
  97. }
  98. .c-color-3 {
  99. color: #333333;
  100. }
  101. .c-color-6 {
  102. color: #666666;
  103. }
  104. .c-color-8 {
  105. color: #888888;
  106. }
  107. .c-color-9 {
  108. color: #999999;
  109. }
  110. .c-color-f {
  111. color: #ffffff;
  112. }
  113. .c-color-n {
  114. color: transparent;
  115. }
  116. // 金钱的颜色
  117. .c-color-MR {
  118. color: #f43530;
  119. }
  120. .c-bg-c {
  121. background-color: #cccccc;
  122. }
  123. .c-bg-0 {
  124. background-color: #000000;
  125. }
  126. .c-bg-9 {
  127. background-color: #999999;
  128. }
  129. .c-bg-f {
  130. background-color: #ffffff;
  131. }
  132. .c-bg-n {
  133. background-color: transparent;
  134. }
  135. // 使用scss配置一些常用css
  136. $pixel: 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 40, 44, 50, 66, 100;
  137. $position: top, right, bottom, left;
  138. $position-class: 't', 'r', 'b', 'l';
  139. // 单个方向
  140. @each $item in $pixel {
  141. @each $p in $position {
  142. $index: index($position, $p);
  143. $class: nth($position-class, $index);
  144. .o-m#{$class}-#{$item} {
  145. margin-#{$p}: $item + rpx;
  146. }
  147. .o-p#{$class}-#{$item} {
  148. padding-#{$p}: $item + rpx;
  149. }
  150. }
  151. }
  152. // 左右或上下两个方向
  153. @each $item in $pixel {
  154. .o-mlr-#{$item} {
  155. margin-left: $item + rpx;
  156. margin-right: $item + rpx;
  157. }
  158. .o-plr-#{$item} {
  159. padding-left: $item + rpx;
  160. padding-right: $item + rpx;
  161. }
  162. .o-mtb-#{$item} {
  163. margin-top: $item + rpx;
  164. margin-bottom: $item + rpx;
  165. }
  166. .o-ptb-#{$item} {
  167. padding-top: $item + rpx;
  168. padding-bottom: $item + rpx;
  169. }
  170. }
  171. /*mr10表示margin-right:10px,其他样式依次类推*/
  172. // text字体大小,radius边框圆角
  173. @for $i from 1 through 50 {
  174. .c-text-#{$i} {
  175. font-size: $i + px;
  176. }
  177. .c-radius-#{$i} {
  178. border-radius: $i + rpx;
  179. }
  180. .l-flex-#{$i} {
  181. flex: $i;
  182. }
  183. }