Last active
June 25, 2023 14:53
-
-
Save ryandejaegher/8b33b264f9785674667cdc91714fc5ba to your computer and use it in GitHub Desktop.
Type Scales #typography
This file contains hidden or 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
| { | |
| "scripts": [], | |
| "styles": [] | |
| } |
This file contains hidden or 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
| - var text = "Quick brown fox jumps over the lazy dog" | |
| doctype html | |
| html(lang="en") | |
| head | |
| meta(charset="UTF-8") | |
| meta(name="viewport", content="width=device-width, initial-scale=1.0") | |
| title Document | |
| script(src="https://cdn.tailwindcss.com") | |
| body | |
| each item,i in Array(8) | |
| p(class=`font-size-${i+1} leading-tight`) #{text} |
This file contains hidden or 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
| |
This file contains hidden or 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
| @use 'sass:math'; | |
| $size: math.pow(2,1); | |
| @mixin type-scale($base,$count,$ratio) { | |
| @for $i from 1 through $count { | |
| .font-size-#{$i} { | |
| font-size: $base * math.pow($ratio,$i); | |
| } | |
| } | |
| } | |
| @include type-scale(16px,8,1.5); | |
| p { | |
| margin: 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment