$w: 10 15 20 25 30 35 40 50 60 75 100; @each $value in $w { .w-p-#{$value} { 100% * $value / 100; } }
@function px2rem($value, $defaultFontSize: 16) { @return ($value / $defaultFontSize) * 1rem; } $spacings: 5 10 15 20 25 30 40 50 60 100; @each $value in $spacings { .pl-#{$value} { padding-left: px2rem($value); } .pr-#{$value} { padding-right: px2rem($value); } .pt-#{$value} { padding-top: px2rem($value); } .pb-#{$value} { padding-bottom: px2rem($value); } .p-#{$value} { padding: px2rem($value); } .ml-#{$value} { margin-left: px2rem($value); } .mr-#{$value} { margin-right: px2rem($value); } .mt-#{$value} { margin-top: px2rem($value); } .mb-#{$value} { margin-bottom: px2rem($value); } .m-#{$value} { margin: px2rem($value); } }
html { font-size: 16px; } @media screen and (min- 375px) { html { font-size: calc(100% + 2 * (100vw - 375px) / 39); font-size: calc(16px + 2 * (100vw - 375px) / 39); } } @media screen and (min- 414px) { html { font-size: calc(112.5% + 4 * (100vw - 414px) / 586); font-size: calc(18px + 4 * (100vw - 414px) / 586); } } @media screen and (min- 600px) { html { font-size: calc(125% + 4 * (100vw - 600px) / 400); font-size: calc(20px + 4 * (100vw - 600px) / 400); } } @media screen and (min- 1000px) { html { font-size: calc(137.5% + 6 * (100vw - 1000px) / 1000); font-size: calc(22px + 6 * (100vw - 1000px) / 1000); } }