-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponsive-typography.scss
41 lines (34 loc) · 1.12 KB
/
responsive-typography.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$debug: false;
// Variables
$responsive-typography__max-width: 1440px !default;
$responsive-typography__small-screen-width: 480px !default;
$responsive-typography__base-html-font-size: 87.5% !default;
$responsive-typography__step: 10px !default;
$responsive-typography__font-size-step: 1% !default;
@mixin responsive-typography {
$steps: ($responsive-typography__max-width - $responsive-typography__small-screen-width) / $responsive-typography__step;
@for $step-i from 0 through $steps {
$viewport-width: $responsive-typography__small-screen-width + $step-i * $responsive-typography__step;
$font-size: $responsive-typography__base-html-font-size + $step-i * $responsive-typography__font-size-step;
// set's the html font-size
@media (min-width: $viewport-width) {
font-size: $font-size;
@if ($debug) {
&:before {
content: "min-width: #{$viewport-width}, font-size: #{$font-size} step: #{$step-i}";
}
}
}
}
@if ($debug) {
&:before {
position: fixed;
top: 1rem;
left: 1rem;
color: red;
}
}
}
html {
@include responsive-typography;
}