margin-padding.scss 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. @use '../define/margin-padding.scss' as *;
  2. $common-level-sizes: (
  3. 0: 0,
  4. 1: 0.25rem,
  5. 2: 0.5rem,
  6. 25: 0.75rem,
  7. 3: 1rem,
  8. 35: 1.25rem,
  9. 4: 1.5rem,
  10. 45: 1.75rem,
  11. 5: 3rem,
  12. );
  13. .m {
  14. &-auto {
  15. margin: auto!important;
  16. }
  17. @each $key, $size in $common-level-sizes {
  18. &-#{$key} {
  19. margin: $size;
  20. }
  21. }
  22. &l {
  23. &-auto {
  24. margin-left: auto!important;
  25. }
  26. @each $key, $size in $common-level-sizes {
  27. &-#{$key} {
  28. margin-left: $size!important;
  29. }
  30. }
  31. @each $key, $size in $common-level-sizes {
  32. &-n#{$key} {
  33. margin-left: -$size!important;
  34. }
  35. }
  36. }
  37. &r {
  38. &-auto {
  39. margin-right: auto!important;
  40. }
  41. @each $key, $size in $common-level-sizes {
  42. &-#{$key} {
  43. margin-right: $size!important;
  44. }
  45. }
  46. @each $key, $size in $common-level-sizes {
  47. &-n#{$key} {
  48. margin-right: -$size!important;
  49. }
  50. }
  51. }
  52. &t {
  53. &-auto {
  54. margin-top: auto!important;
  55. }
  56. @each $key, $size in $common-level-sizes {
  57. &-#{$key} {
  58. margin-top: $size!important;
  59. }
  60. }
  61. @each $key, $size in $common-level-sizes {
  62. &-n#{$key} {
  63. margin-top: -$size!important;
  64. }
  65. }
  66. }
  67. &b {
  68. &-auto {
  69. margin-bottom: auto!important;
  70. }
  71. @each $key, $size in $common-level-sizes {
  72. &-#{$key} {
  73. margin-bottom: $size!important;
  74. }
  75. }
  76. @each $key, $size in $common-level-sizes {
  77. &-n#{$key} {
  78. margin-bottom: -$size!important;
  79. }
  80. }
  81. }
  82. &x {
  83. &-auto {
  84. margin-left: auto!important;
  85. margin-right: auto!important;
  86. }
  87. @each $key, $size in $common-level-sizes {
  88. &-#{$key} {
  89. margin-left: $size!important;
  90. margin-right: $size!important;
  91. }
  92. }
  93. @each $key, $size in $common-level-sizes {
  94. &-n#{$key} {
  95. margin-left: -$size!important;
  96. margin-right: -$size!important;
  97. }
  98. }
  99. }
  100. &y {
  101. &-auto {
  102. margin-top: auto!important;
  103. margin-bottom: auto!important;
  104. }
  105. @each $key, $size in $common-level-sizes {
  106. &-#{$key} {
  107. margin-top: $size!important;
  108. margin-bottom: $size!important;
  109. }
  110. }
  111. @each $key, $size in $common-level-sizes {
  112. &-n#{$key} {
  113. margin-top: -$size!important;
  114. margin-bottom: -$size!important;
  115. }
  116. }
  117. }
  118. }
  119. .p {
  120. &-auto {
  121. padding: auto!important;
  122. }
  123. @each $key, $size in $common-level-sizes {
  124. &-#{$key} {
  125. padding: $size;
  126. }
  127. }
  128. &l {
  129. &-auto {
  130. padding-left: auto!important;
  131. }
  132. @each $key, $size in $common-level-sizes {
  133. &-n#{$key} {
  134. padding-left: -$size!important;
  135. }
  136. }
  137. @each $key, $size in $common-level-sizes {
  138. &-n#{$key} {
  139. padding-left: -$size!important;
  140. }
  141. }
  142. }
  143. &r {
  144. &-auto {
  145. padding-right: auto!important;
  146. }
  147. @each $key, $size in $common-level-sizes {
  148. &-#{$key} {
  149. padding-right: $size!important;
  150. }
  151. }
  152. @each $key, $size in $common-level-sizes {
  153. &-n#{$key} {
  154. padding-right: -$size!important;
  155. }
  156. }
  157. }
  158. &t {
  159. &-auto {
  160. padding-top: auto!important;
  161. }
  162. @each $key, $size in $common-level-sizes {
  163. &-#{$key} {
  164. padding-top: $size!important;
  165. }
  166. }
  167. @each $key, $size in $common-level-sizes {
  168. &-n#{$key} {
  169. padding-top: -$size!important;
  170. }
  171. }
  172. }
  173. &b {
  174. &-auto {
  175. padding-bottom: auto!important;
  176. }
  177. @each $key, $size in $common-level-sizes {
  178. &-#{$key} {
  179. padding-bottom: $size!important;
  180. }
  181. }
  182. @each $key, $size in $common-level-sizes {
  183. &-n#{$key} {
  184. padding-bottom: -$size!important;
  185. }
  186. }
  187. }
  188. &x {
  189. &-auto {
  190. padding-left: auto!important;
  191. padding-right: auto!important;
  192. }
  193. @each $key, $size in $common-level-sizes {
  194. &-#{$key} {
  195. padding-left: $size!important;
  196. padding-right: $size!important;
  197. }
  198. }
  199. @each $key, $size in $common-level-sizes {
  200. &-n#{$key} {
  201. padding-left: -$size!important;
  202. padding-right: -$size!important;
  203. }
  204. }
  205. }
  206. &y {
  207. &-auto {
  208. padding-top: auto!important;
  209. padding-bottom: auto!important;
  210. }
  211. @each $key, $size in $common-level-sizes {
  212. &-#{$key} {
  213. padding-top: $size!important;
  214. padding-bottom: $size!important;
  215. }
  216. }
  217. @each $key, $size in $common-level-sizes {
  218. &-n#{$key} {
  219. padding-top: -$size!important;
  220. padding-bottom: -$size!important;
  221. }
  222. }
  223. }
  224. }
  225. .h-100vh {
  226. height: 100vh;
  227. }
  228. .h-0 {
  229. height: 0;
  230. }
  231. .l-0 {
  232. left: 0;
  233. }
  234. .r-0 {
  235. right: 0;
  236. }
  237. .t-0 {
  238. top: 0;
  239. }
  240. .b-0 {
  241. bottom: 0;
  242. }
  243. .margin {
  244. &-all {
  245. @each $key, $size in $margins {
  246. &-#{$key} {
  247. margin: $size;
  248. }
  249. }
  250. }
  251. &-top {
  252. @each $key, $size in $margins {
  253. &-#{$key} {
  254. margin-top: $size;
  255. }
  256. }
  257. }
  258. &-bottom {
  259. @each $key, $size in $margins {
  260. &-#{$key} {
  261. margin-bottom: $size;
  262. }
  263. }
  264. }
  265. &-left {
  266. @each $key, $size in $margins {
  267. &-#{$key} {
  268. margin-left: $size;
  269. }
  270. }
  271. }
  272. &-right {
  273. @each $key, $size in $margins {
  274. &-#{$key} {
  275. margin-right: $size;
  276. }
  277. }
  278. }
  279. &-none {
  280. margin: 0;
  281. &-left-right {
  282. margin-left: 0;
  283. margin-right: 0;
  284. }
  285. &-top-bottom {
  286. margin-top: 0;
  287. margin-bottom: 0;
  288. }
  289. }
  290. }
  291. .padding {
  292. &-all {
  293. @each $key, $size in $paddings {
  294. &-#{$key} {
  295. padding: $size;
  296. }
  297. }
  298. }
  299. &-top {
  300. @each $key, $size in $paddings {
  301. &-#{$key} {
  302. padding-top: $size;
  303. }
  304. }
  305. }
  306. &-bottom {
  307. @each $key, $size in $paddings {
  308. &-#{$key} {
  309. padding-bottom: $size;
  310. }
  311. }
  312. }
  313. &-left {
  314. @each $key, $size in $paddings {
  315. &-#{$key} {
  316. padding-left: $size;
  317. }
  318. }
  319. }
  320. &-right {
  321. @each $key, $size in $paddings {
  322. &-#{$key} {
  323. padding-right: $size;
  324. }
  325. }
  326. }
  327. &-none {
  328. padding: 0;
  329. &-left-right {
  330. padding-left: 0;
  331. padding-right: 0;
  332. }
  333. &-top-bottom {
  334. padding-top: 0;
  335. padding-bottom: 0;
  336. }
  337. }
  338. }