Last active
July 5, 2019 06:20
-
-
Save madeas/3227715407d61ea7a550b708d9ab2d8d to your computer and use it in GitHub Desktop.
Sass mixin for the headings: file #1 REM, file #2 PX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$base-font-size: 16px; | |
$heading-scale: 6; | |
@for $i from 1 through 6 { | |
h#{$i} { | |
font-size: $base-font-size + $heading-scale * (6 - $i); | |
} | |
} | |
// sizes 46px, 40px, 34px, 28px, 22px, 16px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$step-size-heading: 0.4; | |
$amplifier-heading: 1.25; | |
@mixin heading-size($size) { | |
font-size: $size * $step-size-heading * $amplifier-heading + rem; | |
} | |
h1 { | |
@include heading-size(6); // 3rem | |
} | |
h2 { | |
@include heading-size(5); // 2.5rem | |
} | |
h3 { | |
@include heading-size(4); // 2rem | |
} | |
h4 { | |
@include heading-size(3); // 1.5rem | |
} | |
h5 { | |
font-size: 1.25rem; // 1.25rem (if include = 1rem) | |
} | |
h6 { | |
font-size: 1rem; // 1rem (if include = 0.5rem) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment