Skip to content

Instantly share code, notes, and snippets.

@stordahl
Created December 20, 2021 13:30
Show Gist options
  • Save stordahl/dee42c9b8c0f6bd681788212c457760c to your computer and use it in GitHub Desktop.
Save stordahl/dee42c9b8c0f6bd681788212c457760c to your computer and use it in GitHub Desktop.
Responsive Typography Boilerplate
body {
--f-s-xl: clamp(3rem, 12vw + 1rem, 5rem);
--f-s-lg: 1.5rem;
--f-s-md: 1.25rem;
--f-s-sm: 1rem;
}
@media screen and (min-width: 40em){
body {
--f-s-lg: 2rem;
--f-s-md: 1.5rem;
--f-s-sm: 1.125rem;
}
}
body * { font-size: var(--f-s-sm); }
h1 { font-size: var(--f-s-xl); }
h2 { font-size: var(--f-s-l); }
h3 { font-size: var(--f-s-l); }
h4 { font-size: var(--f-s-md); }
h5 { font-size: var(--f-s-md); }
h6 { font-size: var(--f-s-sm); }
p, a { font-size: var(--f-s-sm); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment